# Monster Destroyer 2.1

**URL:** <https://forum.makecode.com/t/monster-destroyer-2-1/4029>\
**Category:** Arcade\
**Tags:** game\
**Created:** [October 23, 2020, 3:21am UTC](https://forum.makecode.com/t/monster-destroyer-2-1/4029 "2020-10-23T03:21:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeterPapadum91](https://avatars.discourse-cdn.com/v4/letter/p/d9b06d/32.png) [@PeterPapadum91](https://forum.makecode.com/u/PeterPapadum91)\
**Post date:** [October 23, 2020, 3:21am UTC](https://forum.makecode.com/t/monster-destroyer-2-1/4029/1 "2020-10-23T03:21:47Z")

</div>

> **[Monster Destroyer 2.1.](https://arcade.makecode.com/70653-51934-12229-43895)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<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:** [October 25, 2020, 10:40pm UTC](https://forum.makecode.com/t/monster-destroyer-2-1/4029/2 "2020-10-25T22:40:04Z")

</div>

Hi Peter, you have a very interesting game. I like the idea that the projectiles fire off in all different directions.

I noticed a few ‘bugs’ in the game. Whenever you use the ‘overlap event’ to destroy the ‘other’ sprite, for example:

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/2/212483d1591046a50f4dfcbcdeaa7658634da8d7.png)

You need to reference the variables within the event block, i.e.:

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

So in this example, you are destroying the ‘sprite’ variable in the event loop, not the variable ‘Ghost’. Each time you create a ‘Ghost’, only the last sprite that was assigned to the variable is the one the can be destroyed. Try it in your game; let two ghosts appear, and have the first ghost kill you. You will notice that first sprite is not destroyed, because ‘Ghost’ points to the second ghost set in the game, and keeps on killing you.

Same thing for the projectiles.

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/f/fecd101eccdb27d75fce91aa06f6f522cabd63c4.png)

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/f/f155b4aab8a328233cd3859d2fffcb32118ec77a.png)

In this example, you are destroying both the 'sprite (the projectile) and the ‘otherSprite’ (the enemy Ghost).

For all the projectiles, I also gave them a random life span. That way they will destroy themselves after the life span has ended. Otherwise the projectiles will just remain on the screen. You decide yourself if you want to change this.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/a/a409502b5499a3299e82a054c1e6d0ace463b58e.png)

Also, since you gave the projectiles a random direction, there is no need have them follow the enemy.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/8/877d8e98eb5912d33ab67db31b32b303a3813bf4.png)

You can see my fixes here.

> **[Monster Destroyer 2.1. cosmos](https://arcade.makecode.com/81459-85683-40104-72528)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Let me know if you have any questions.  
You have made a really good game, keep up the good work.
