# Can you have multiple instances of the same sprite

**URL:** <https://forum.makecode.com/t/can-you-have-multiple-instances-of-the-same-sprite/1872>\
**Category:** Arcade\
**Created:** [April 29, 2020, 4:58pm UTC](https://forum.makecode.com/t/can-you-have-multiple-instances-of-the-same-sprite/1872 "2020-04-29T16:58:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MrHM](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@MrHM](https://forum.makecode.com/u/MrHM)\
**Post date:** [April 29, 2020, 4:58pm UTC](https://forum.makecode.com/t/can-you-have-multiple-instances-of-the-same-sprite/1872/1 "2020-04-29T16:58:33Z")

</div>

Hello, I am experienced with other game engines and trying to figure out arcade. I am trying to develop the classic Space Invaders with my class. I want to have a row of invaders moving back and forth on the screen. Is there an inherit way of creating multiple instances of the same sprite, say myLargeInvader. In my example, only one of the invaders is handled in the ON GAME UPDATE.

> **[SpaceInvaders](https://arcade.makecode.com/22533-94049-04636-11742)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Other engines know to apply code to all instances of myLargeInvader…curious, if and how arcade manages this?

---

<div class="post-metadata">

**Author:** ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)\
**Post date:** [April 29, 2020, 5:05pm UTC](https://forum.makecode.com/t/can-you-have-multiple-instances-of-the-same-sprite/1872/2 "2020-04-29T17:05:00Z")

</div>

If you give them a unique kind (in this case, `Enemy`), you can get an array of all of them and apply the action to each of them in a loop in your game update:

 ![SmartSelect_20200429-100236_Chrome](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/1X/12f47ff13d1efed1b2736ba2c34248660589f5d9.jpeg)

`array of sprites of kind` is currently in the arrays category.

---

<div class="post-metadata">

**Author:** ![peli](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/peli/32/12_2.png) [@peli](https://forum.makecode.com/u/peli)\
**Post date:** [April 29, 2020, 5:41pm UTC](https://forum.makecode.com/t/can-you-have-multiple-instances-of-the-same-sprite/1872/3 "2020-04-29T17:41:27Z")

</div>

Like @jwunderl said…

> **[SpaceInvaders](https://arcade.makecode.com/40550-67328-22190-10168)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![MrHM](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@MrHM](https://forum.makecode.com/u/MrHM)\
**Post date:** [April 29, 2020, 6:00pm UTC](https://forum.makecode.com/t/can-you-have-multiple-instances-of-the-same-sprite/1872/4 "2020-04-29T18:00:07Z")

</div>

Thanks, that is helpful insight into this engine. The array is nice so I can redirect the entire row to change course.

> **[SpaceInvaders](https://arcade.makecode.com/40358-90098-16611-54127)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![MrHM](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@MrHM](https://forum.makecode.com/u/MrHM)\
**Post date:** [April 29, 2020, 8:58pm UTC](https://forum.makecode.com/t/can-you-have-multiple-instances-of-the-same-sprite/1872/5 "2020-04-29T20:58:39Z")

</div>

Thanks again for the help. Here is a complete version with the following features:

1. 3 rows of invaders move back and forth
2. Base ship can only fire once per second
3. The invaders speed up as the number of invaders decrease
4. If the invaders get low enough to collide with base, game over
5. If you destroy all invaders, game over with a win

> **[SpaceInvaders](https://arcade.makecode.com/16969-85639-49498-44579)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Plenty of concepts to teach students. Will start recording the lessons now. A challenge for students will be to have the Invaders fire randomly downward, but never more than two invaders shots on the screen at once.

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [April 29, 2020, 9:58pm UTC](https://forum.makecode.com/t/can-you-have-multiple-instances-of-the-same-sprite/1872/6 "2020-04-29T21:58:44Z")

</div>

Awesome! If you record some lessons (and don’t mind making them public) please post them in the forum! We love to have more content to point people too.

---

<div class="post-metadata">

**Author:** ![MrHM](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@MrHM](https://forum.makecode.com/u/MrHM)\
**Post date:** [April 29, 2020, 10:54pm UTC](https://forum.makecode.com/t/can-you-have-multiple-instances-of-the-same-sprite/1872/7 "2020-04-29T22:54:55Z")

</div>

Will do

---

<div class="post-metadata">

**Author:** ![jsea](https://avatars.discourse-cdn.com/v4/letter/j/a5b964/32.png) [@jsea](https://forum.makecode.com/u/jsea)\
**Post date:** [April 30, 2020, 3:16am UTC](https://forum.makecode.com/t/can-you-have-multiple-instances-of-the-same-sprite/1872/8 "2020-04-30T03:16:52Z")

</div>

very useful - much to learn here!
