# Player overlap on enemy projectile

**URL:** <https://forum.makecode.com/t/player-overlap-on-enemy-projectile/2434>\
**Category:** Help\
**Created:** [June 15, 2020, 5:33pm UTC](https://forum.makecode.com/t/player-overlap-on-enemy-projectile/2434 "2020-06-15T17:33:40Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MINTGenie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mintgenie/32/1052_2.png) [@MINTGenie](https://forum.makecode.com/u/MINTGenie)\
**Post date:** [June 15, 2020, 5:33pm UTC](https://forum.makecode.com/t/player-overlap-on-enemy-projectile/2434/1 "2020-06-15T17:33:40Z")

</div>

Hi Makecode Team,  
How to check overlap events for player overlapping on Enemy’s projectile and is there a way for this projectile to follow the player ?  
I noticed that even though I have set the projectile to start from monster sprite (the sprite has bobbing animation), I see that the projectile is created from static location. Am i missing something?

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

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

Full code at [https://github.com/mintgenie/daveawesome-throwback/tree/SpideyFire\_lvl3](https://github.com/mintgenie/daveawesome-throwback/tree/SpideyFire_lvl3)

Warm regards  
MINTGenie

---

<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:** [June 15, 2020, 6:29pm UTC](https://forum.makecode.com/t/player-overlap-on-enemy-projectile/2434/2 "2020-06-15T18:29:59Z")

</div>

Seems to be working for me:

> **[projectile-animation-test](https://arcade.makecode.com/27953-58791-37901-86596)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Make sure the variable you are passing to create projectile is assigned; you can use the debugger to check

---

<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:** [June 15, 2020, 6:30pm UTC](https://forum.makecode.com/t/player-overlap-on-enemy-projectile/2434/3 "2020-06-15T18:30:43Z")

</div>

as for following, we have a “follow sprite” block in the sprites category

---

<div class="post-metadata">

**Author:** ![MINTGenie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mintgenie/32/1052_2.png) [@MINTGenie](https://forum.makecode.com/u/MINTGenie)\
**Post date:** [June 15, 2020, 11:36pm UTC](https://forum.makecode.com/t/player-overlap-on-enemy-projectile/2434/4 "2020-06-15T23:36:42Z")

</div>

@richard, thanks for the pointers, i made sure that i am using the right values but If both player and enemy have projectiles then there is no way to differentiate between player overlapping projectile and enemy overlapping projectile (ex. player shoots bullets and enemy throws fire). Here both enemy are player are triggerring their own events.)  
I dont have a way to test for projectile from enemy or player.  
is this a feature request or is there a work around.

Here is the latest code: [https://github.com/mintgenie/daveawesome-throwback/tree/SpideyFire\_lvl3](https://github.com/mintgenie/daveawesome-throwback/tree/SpideyFire_lvl3)  
Please help. I want to move to next step but these are bugging a lot.

Warm regards  
MINTGenie

---

<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:** [June 15, 2020, 11:55pm UTC](https://forum.makecode.com/t/player-overlap-on-enemy-projectile/2434/5 "2020-06-15T23:55:46Z")

</div>

You need to change the “kind” of the projectiles. By default all projectiles have the kind “Projectile” but they can have their kind set just like any other sprite. Here’s an example:

> **[projectile-kind](https://arcade.makecode.com/03733-93118-69429-78860)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Here I created two kinds: PlayerProjectile and EnemyProjectile. That lets me split up the overlap logic for both kinds of sprites.

---

<div class="post-metadata">

**Author:** ![MINTGenie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mintgenie/32/1052_2.png) [@MINTGenie](https://forum.makecode.com/u/MINTGenie)\
**Post date:** [June 16, 2020, 7:32am UTC](https://forum.makecode.com/t/player-overlap-on-enemy-projectile/2434/6 "2020-06-16T07:32:00Z")

</div>

Oh ok… now I see that i had (once again) completely missed this “Set mySprite to kind \< \>” block rather, i had only tried using the Set without any luck. I works now…  
You saved my day again!!! Thanks.  
Here is the update: [https://makecode.com/\_KMoKbhEE3U0A](https://makecode.com/_KMoKbhEE3U0A)  
The browser is sooo slow with this huge set of blocks and dont let me make quick changes. are there some tricks to speed this up (may be option for stopping live compilation)

Warm regards  
MINTGenie

Warm regards  
MINTGenie

---

<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:** [June 16, 2020, 4:49pm UTC](https://forum.makecode.com/t/player-overlap-on-enemy-projectile/2434/7 "2020-06-16T16:49:30Z")

</div>

The best way to speed things up is to collapse the simulator (the grey arrow tab next to it)

---

<div class="post-metadata">

**Author:** ![MINTGenie](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mintgenie/32/1052_2.png) [@MINTGenie](https://forum.makecode.com/u/MINTGenie)\
**Post date:** [June 16, 2020, 4:53pm UTC](https://forum.makecode.com/t/player-overlap-on-enemy-projectile/2434/8 "2020-06-16T16:53:08Z")

</div>

👍 better now…thx
