# Trying to spawn random enemies

**URL:** <https://forum.makecode.com/t/trying-to-spawn-random-enemies/8537>\
**Category:** Help\
**Created:** [June 4, 2021, 5:36pm UTC](https://forum.makecode.com/t/trying-to-spawn-random-enemies/8537 "2021-06-04T17:36:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArboTeach](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/arboteach/32/2990_2.png) [@ArboTeach](https://forum.makecode.com/u/ArboTeach)\
**Post date:** [June 4, 2021, 5:36pm UTC](https://forum.makecode.com/t/trying-to-spawn-random-enemies/8537/1 "2021-06-04T17:36:22Z")

</div>

My student set the random image but that changes how the enemy ship looks it doesn’t spawn a new enemy ship. How do we spawn a new enemy ship that you can shoot at

> **[Alien Fleet Attack!](https://arcade.makecode.com/38796-33227-49177-69471)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![ThunderDrop180](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/thunderdrop180/32/6820_2.png) [@ThunderDrop180](https://forum.makecode.com/u/ThunderDrop180)\
**Post date:** [June 6, 2021, 5:04pm UTC](https://forum.makecode.com/t/trying-to-spawn-random-enemies/8537/2 "2021-06-06T17:04:18Z")

</div>

> **[Alien Fleet Attack!](https://arcade.makecode.com/86185-89434-34037-05834)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I unfortunately couldn’t figure this out  
I left a note in the code  
hehe  
@UnsignedArduino we need you lol

---

<div class="post-metadata">

**Author:** ![WoodysWorkshop](https://avatars.discourse-cdn.com/v4/letter/w/ea666f/32.png) [@WoodysWorkshop](https://forum.makecode.com/u/WoodysWorkshop)\
**Post date:** [June 6, 2021, 5:08pm UTC](https://forum.makecode.com/t/trying-to-spawn-random-enemies/8537/3 "2021-06-06T17:08:24Z")

</div>

Hi,

> **[Alien Fleet Attack V3](https://arcade.makecode.com/48606-56129-22697-80736)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

This was a good refresher to have a play around with.

What I did was: Create an array of images (for what the sprite could look like), on start…

On the game update; I created an enemy sprite and then chose the image randomly from the list. I also included a feature where it can shoot back.

I have not used projectiles when there are enemies that shoot back at you because this can cause conflict when you are using the overlap block (I.e… on sprite of kind ‘projectile’ overlaps with ‘enemy’… you’re setting yourself up to fail when the enemy shoots a projectile and kills itself)… so this is why I made them separate sprites of their own unique kinds.

I hope this helps?

All the best  
Woody

---

<div class="post-metadata">

**Author:** ![DahbixLP](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dahbixlp/32/4760_2.png) [@DahbixLP](https://forum.makecode.com/u/DahbixLP)\
**Post date:** [June 6, 2021, 5:13pm UTC](https://forum.makecode.com/t/trying-to-spawn-random-enemies/8537/4 "2021-06-06T17:13:23Z")

</div>

I hope this fixes it! The image was set to list! The lmage has to be pick random from list!

> **[Alien Fleet Attack!](https://arcade.makecode.com/89937-84524-60252-08424)**
>
> Erstellt mit ❤️ in Microsoft MakeCode Arcade.

(Just a quick fix the rest is up to you!)

---

<div class="post-metadata">

**Author:** ![ArboTeach](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/arboteach/32/2990_2.png) [@ArboTeach](https://forum.makecode.com/u/ArboTeach)\
**Post date:** [June 7, 2021, 3:48pm UTC](https://forum.makecode.com/t/trying-to-spawn-random-enemies/8537/5 "2021-06-07T15:48:06Z")

</div>

thanks this is just what he was looking for
