# How to make projectiles split when hitting wall?

**URL:** <https://forum.makecode.com/t/how-to-make-projectiles-split-when-hitting-wall/35003>\
**Category:** Help\
**Created:** [March 29, 2025, 6:12pm UTC](https://forum.makecode.com/t/how-to-make-projectiles-split-when-hitting-wall/35003 "2025-03-29T18:12:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![awdrgyjil](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/awdrgyjil/32/20926_2.png) [@awdrgyjil](https://forum.makecode.com/u/awdrgyjil)\
**Post date:** [March 29, 2025, 6:12pm UTC](https://forum.makecode.com/t/how-to-make-projectiles-split-when-hitting-wall/35003/1 "2025-03-29T18:12:04Z")

</div>

> **[Voltaic](https://arcade.makecode.com/S27441-05363-03000-56359)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I want my boss to have an attack where when the projectile hits a wall it splits and goes in different directions, idk how to though

---

<div class="post-metadata">

**Author:** ![ShaneyBoi09](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/shaneyboi09/32/18893_2.png) [@ShaneyBoi09](https://forum.makecode.com/u/ShaneyBoi09)\
**Post date:** [March 29, 2025, 9:49pm UTC](https://forum.makecode.com/t/how-to-make-projectiles-split-when-hitting-wall/35003/2 "2025-03-29T21:49:19Z")

</div>

![Screenshot 2025-03-29 163903](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/f/a/fa9c500e19693fb22394c2f0baf956bfe13a8787.png)  
Perhaps this will help u. im sorry I couldnt be more helpful.

---

<div class="post-metadata">

**Author:** ![awdrgyjil](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/awdrgyjil/32/20926_2.png) [@awdrgyjil](https://forum.makecode.com/u/awdrgyjil)\
**Post date:** [March 31, 2025, 12:36am UTC](https://forum.makecode.com/t/how-to-make-projectiles-split-when-hitting-wall/35003/3 "2025-03-31T00:36:21Z")

</div>

Sorry my game doesn’t have a tilemap so this doesn’t work

---

<div class="post-metadata">

**Author:** ![CrunchyToast](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/crunchytoast/32/17780_2.png) [@CrunchyToast](https://forum.makecode.com/u/CrunchyToast)\
**Post date:** [March 31, 2025, 6:02pm UTC](https://forum.makecode.com/t/how-to-make-projectiles-split-when-hitting-wall/35003/4 "2025-03-31T18:02:45Z")

</div>

Make the walls a different, separate sprite. Then, you could add some collision code which would first check the projectiles direction. If it falls into the category of 8 directional, just add some code to check which of the 2 directions of more than the other and then only render that. On contact with the wall, use vx and vy code to help the projectile split up and bounce off the walls.

Tell me if this helps!  
CrunchyToast

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [April 1, 2025, 5:06pm UTC](https://forum.makecode.com/t/how-to-make-projectiles-split-when-hitting-wall/35003/5 "2025-04-01T17:06:41Z")

</div>

I think if you replace the “on overlap” block with a “on sprite hits wall at location” block. I’m pretty sure that will detect the wall bounces correctly, even though you don’t have a tilemap.

---

<div class="post-metadata">

**Author:** ![awdrgyjil](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/awdrgyjil/32/20926_2.png) [@awdrgyjil](https://forum.makecode.com/u/awdrgyjil)\
**Post date:** [April 3, 2025, 3:02am UTC](https://forum.makecode.com/t/how-to-make-projectiles-split-when-hitting-wall/35003/6 "2025-04-03T03:02:15Z")

</div>

I tried this but it didn’t work, I think that only works on tilemaps

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [April 3, 2025, 11:43am UTC](https://forum.makecode.com/t/how-to-make-projectiles-split-when-hitting-wall/35003/7 "2025-04-03T11:43:25Z")

</div>

Yeah, I just tried it and it didn’t work. Looking at the code, it doesn’t look like there are many sprite events that you could use to detect this, besides maybe using an “On Destroyed Sprite of kind…” block, because projectiles get automatically destroyed when they go off screen?  
You could always code in a loop that checks through all the projectiles to see if they are on the wall using their left, right, top, and bottom coords to detect.  
You would want to check if the left or top of the sprite is less than or equal to 0 “( (mysprite) [left]) [\<=] ( 0 ) )” and you would want to be checking if the right is \>= 160 or bottom \>= 120.
