# Help with Program Containing a list

**URL:** <https://forum.makecode.com/t/help-with-program-containing-a-list/34785>\
**Category:** Arcade\
**Tags:** game, make\
**Created:** [March 21, 2025, 10:34pm UTC](https://forum.makecode.com/t/help-with-program-containing-a-list/34785 "2025-03-21T22:34:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mgn](https://avatars.discourse-cdn.com/v4/letter/m/3ab097/32.png) [@mgn](https://forum.makecode.com/u/mgn)\
**Post date:** [March 21, 2025, 10:34pm UTC](https://forum.makecode.com/t/help-with-program-containing-a-list/34785/1 "2025-03-21T22:34:09Z")

</div>

The program I am trying to make is supposed to create 100 fireworks, place them in a list, and when you hit a it is suppose to explode. Can anyone look at my code and tell me why the one I created does not work. I am missing a fundamental part of arrays because this is the second or third time I have run into a program with arrays that does not work. Definitely does not help that I am the only teacher in my building using this platform. Your help is appreciated.

> **[2025 Exploding Fireworks](https://arcade.makecode.com/S40486-11401-89030-54150)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![hassan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/hassan/32/1457_2.png) [@hassan](https://forum.makecode.com/u/hassan)\
**Post date:** [March 22, 2025, 2:35am UTC](https://forum.makecode.com/t/help-with-program-containing-a-list/34785/2 "2025-03-22T02:35:43Z")

</div>

Hello!

Everywhere you are using the `length of array` block, you need to set the variable to `Firework` list in the drop down instead of just `list`. You also want to use the math block `num - num` to remove 1 from the index of each firework since arrays are indexed starting with position 0.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/9/0/90375a38c12fd3453ffcd29ba7736ad2ede88117.png)

If you know the length of the array, then you can create a variable to keep track of it. Then use a `for index from 0 to number` loop to create each fire work. That way, you can just use the calculated `index` variable you get as part of the loop. Don’t forget to still minus one from the number of fireworks since we starting the count at 0.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/4/8/4814f71cca9f2f95137d8d9e114d0168e058ef44.png)

As for the A button press, try removing the `repeat 30` block since you already have a for loop going through every firework sprite in the list.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/3/d/3dac125dc579b5e23d61627fb6038db35a219289.png)

Here is the code with the changes:

> **[2025 Exploding Fireworks](https://arcade.makecode.com/64946-89482-95594-07351)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Try messing around with the `start effect` block as well! [https://makecode.com/\_iDUdwh9yCVFf](https://makecode.com/_iDUdwh9yCVFf)

---

<div class="post-metadata">

**Author:** ![hassan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/hassan/32/1457_2.png) [@hassan](https://forum.makecode.com/u/hassan)\
**Post date:** [March 22, 2025, 2:39am UTC](https://forum.makecode.com/t/help-with-program-containing-a-list/34785/3 "2025-03-22T02:39:36Z")

</div>

You can get your `repeat 30` block to work if you add a pause of 1ms between each iteration:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/c/0/c04c44482a0300abed9991e00247ab2ee3764172.png)
