# Shooter

**URL:** <https://forum.makecode.com/t/shooter/3271>\
**Category:** Help\
**Created:** [August 29, 2020, 10:52am UTC](https://forum.makecode.com/t/shooter/3271 "2020-08-29T10:52:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TakeTheL08](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/takethel08/32/7018_2.png) [@TakeTheL08](https://forum.makecode.com/u/TakeTheL08)\
**Post date:** [August 29, 2020, 10:52am UTC](https://forum.makecode.com/t/shooter/3271/1 "2020-08-29T10:52:11Z")

</div>

Please help me!  
My code won’t make more than one enemy, even though it should. SOMEONE PLEASE HELP MEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE!!!

> **[Shooter](https://arcade.makecode.com/05501-08892-12160-09271)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![TakeTheL08](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/takethel08/32/7018_2.png) [@TakeTheL08](https://forum.makecode.com/u/TakeTheL08)\
**Post date:** [August 29, 2020, 10:55am UTC](https://forum.makecode.com/t/shooter/3271/2 "2020-08-29T10:55:26Z")

</div>

The block of code you need to look at is the huge forever loop at the far right

---

<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:** [December 6, 2020, 7:28pm UTC](https://forum.makecode.com/t/shooter/3271/4 "2020-12-06T19:28:57Z")

</div>

Hi! Try replacing it with a on game update every 5 seconds! (Or just on game update)

---

<div class="post-metadata">

**Author:** ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)\
**Post date:** [December 7, 2020, 10:58pm UTC](https://forum.makecode.com/t/shooter/3271/5 "2020-12-07T22:58:35Z")

</div>

@DahbixLP is correct in saying that you can better use a game update interval method, if that is what your intention is (to display either an enemy of friend every 5 seconds).

I will try to explain why this is happening. The game loop just keeps occurring, so you are expecting to create multiple sprites to be either an enemy or a friend. However, in the ‘on created’ events, you are pausing the code (which means the game loop cannot proceed until the pause has finished), then the sprite is deleted, and the game loop can continue again. You have a few different options:

1. if you want a sprite to be created every 5 seconds, move the code into a game update interval block;
2. if you want to keep the current game loop, move the pause and delete into a separate code block that runs independent of the game loop. You need to use the ‘timers’ extension to run code separately. This does mean that many sprites are created as the game loop runs every few milliseconds (the exact amount of ms I do not know).

> **[Shooter (cosmos)](https://arcade.makecode.com/11285-15027-16684-34860)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.
