# Making a destructible tile for a bossfight

**URL:** <https://forum.makecode.com/t/making-a-destructible-tile-for-a-bossfight/30017>\
**Category:** Help\
**Created:** [August 7, 2024, 10:52pm UTC](https://forum.makecode.com/t/making-a-destructible-tile-for-a-bossfight/30017 "2024-08-07T22:52:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HelpMeh](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@HelpMeh](https://forum.makecode.com/u/HelpMeh)\
**Post date:** [August 7, 2024, 10:52pm UTC](https://forum.makecode.com/t/making-a-destructible-tile-for-a-bossfight/30017/1 "2024-08-07T22:52:04Z")

</div>

So I made a boss fight with a tile that acts as a barrier

 ![sssssss](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/8/3/836a1c32f659c04aae4065e86874f9d88b997caa.jpeg)

Though this makes for a very boring bossfight, so I’m trying to make it so whenever the boss collides with the barrier, it will begin to break, switching between different phases of brokenness before completely being destroyed. My only issue is that the only block that I can find that is similar to what I need is an overlap block, which doesn’t work as the boss isn’t technically overlapping the block.

---

<div class="post-metadata">

**Author:** ![NeoStreak](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/neostreak/32/27498_2.png) [@NeoStreak](https://forum.makecode.com/u/NeoStreak)\
**Post date:** [August 7, 2024, 11:37pm UTC](https://forum.makecode.com/t/making-a-destructible-tile-for-a-bossfight/30017/2 "2024-08-07T23:37:28Z")

</div>

To do this, make it so that if the boss touches the barrier, it replaces the tile. Here’s an example:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/f/b/fb1e0b398a4da062cb318fcac20ff5596c48a71e.png)  
You see, in this function, every time an enemy hits Mario when he has 0 velocity, Super Mario gets destroyed and replaced by small mario. You can also do this:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/9/f/9fb10937194ca0090f2f22c036607402a2ed995b.png)  
Which lets you create the barrier as a sprite, therefore, letting it be destroyed, and using the “set sprite position to sprite x y sprite y” thing. This might be complicated though. 😅

---

<div class="post-metadata">

**Author:** ![MichaelsMakecode](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/michaelsmakecode/32/15090_2.png) [@MichaelsMakecode](https://forum.makecode.com/u/MichaelsMakecode)\
**Post date:** [August 8, 2024, 3:59am UTC](https://forum.makecode.com/t/making-a-destructible-tile-for-a-bossfight/30017/3 "2024-08-08T03:59:44Z")

</div>

Something like this?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/3/4/34570556c8613c5532cf70a78efc60016f37e2c2.png)

---

<div class="post-metadata">

**Author:** ![HelpMeh](https://avatars.discourse-cdn.com/v4/letter/h/e0b2c6/32.png) [@HelpMeh](https://forum.makecode.com/u/HelpMeh)\
**Post date:** [August 8, 2024, 5:05pm UTC](https://forum.makecode.com/t/making-a-destructible-tile-for-a-bossfight/30017/4 "2024-08-08T17:05:07Z")

</div>

Exactly what I needed! My only issue is that this code makes it so there is no waiting time in between phases so it instantly goes from completely fine to fully broken. I have tried to add a timer system but all it does is slow the process (I mean as soon as it gets touched it starts to break, and even when the boss stops touching it it will keep going through the phases and eventually break when nothing was touching it) instead of it stopping at the phase it’s currently at whenever the boss stops touching it and wait for it to be touched again.
