# Boss falls from platform/ problem code with Meowbit

**URL:** <https://forum.makecode.com/t/boss-falls-from-platform-problem-code-with-meowbit/2109>\
**Category:** Help\
**Created:** [May 16, 2020, 4:30pm UTC](https://forum.makecode.com/t/boss-falls-from-platform-problem-code-with-meowbit/2109 "2020-05-16T16:30:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bilu](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@Bilu](https://forum.makecode.com/u/Bilu)\
**Post date:** [May 16, 2020, 4:30pm UTC](https://forum.makecode.com/t/boss-falls-from-platform-problem-code-with-meowbit/2109/1 "2020-05-16T16:30:44Z")

</div>

> **[JUMPJUMPLAND](https://arcade.makecode.com/60769-55280-76551-29447)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

hello everyone, i have two problems.  
the first concerns the boss, sometimes he falls from the platform when he is injured, or when he is pushed against the walls. it also falls.  
the second problem is that the code does not run well on Meowbit. (in gameover, jump on enemies and other objects for example).  
If anyone can help me, I thank him in advance.

---

<div class="post-metadata">

**Author:** ![felixtsu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/felixtsu/32/12024_2.png) [@felixtsu](https://forum.makecode.com/u/felixtsu)\
**Post date:** [May 17, 2020, 9:02am UTC](https://forum.makecode.com/t/boss-falls-from-platform-problem-code-with-meowbit/2109/2 "2020-05-17T09:02:33Z")

</div>

Tried to reproduce problem 1

 ![Screen Recording 2020-05-17 at 4.51.20 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/1X/5198d1ba8babd099eac295220fc9f00895b5332b.gif)

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

Changing x of BOSS without a proper wall check might cause problem 1.

I guess you want to bounce boss back a little to avoid immediate death by successive overlap events, an alternative way could be setting BOSS or Player into GHOST mode for a short period of time.

Very nice game, learned a lot the way you code the ladder.

Cheers

---

<div class="post-metadata">

**Author:** ![Blobiy](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Blobiy](https://forum.makecode.com/u/Blobiy)\
**Post date:** [May 17, 2020, 11:52pm UTC](https://forum.makecode.com/t/boss-falls-from-platform-problem-code-with-meowbit/2109/3 "2020-05-17T23:52:26Z")

</div>

suggestion:  
go to another small tile map once in “Boss Battle”  
Issue 1 is as said above, its due to the change in x, also i suggest there be a “invincible” time after being hit, same for the player and the BOSS, this way you don’t get stuck in infinite loops of getting hit.  
Lastly:  
the graphics/art is SO GOOD, it all fits in one art style, and looks great. keep on making!!!

thanks

- Blobiy

---

<div class="post-metadata">

**Author:** ![Bilu](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@Bilu](https://forum.makecode.com/u/Bilu)\
**Post date:** [May 18, 2020, 9:12pm UTC](https://forum.makecode.com/t/boss-falls-from-platform-problem-code-with-meowbit/2109/4 "2020-05-18T21:12:40Z")

</div>

Thanks for your help,

the Ghost “method” doesn’t work on platform Game, player falls through the walls ^^.  
Yes, the idea is the boss bounce on the wall.

---

<div class="post-metadata">

**Author:** ![Bilu](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@Bilu](https://forum.makecode.com/u/Bilu)\
**Post date:** [May 18, 2020, 9:14pm UTC](https://forum.makecode.com/t/boss-falls-from-platform-problem-code-with-meowbit/2109/5 "2020-05-18T21:14:41Z")

</div>

Thanks for your help,

i think the “small tilemap” is a good idea. Maybe with a door to teleport the player on that tilemap.

---

<div class="post-metadata">

**Author:** ![felixtsu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/felixtsu/32/12024_2.png) [@felixtsu](https://forum.makecode.com/u/felixtsu)\
**Post date:** [May 18, 2020, 11:34pm UTC](https://forum.makecode.com/t/boss-falls-from-platform-problem-code-with-meowbit/2109/6 "2020-05-18T23:34:58Z")

</div>

Use a variable to implement ghost mode.

---

<div class="post-metadata">

**Author:** ![Bilu](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@Bilu](https://forum.makecode.com/u/Bilu)\
**Post date:** [May 19, 2020, 7:59am UTC](https://forum.makecode.com/t/boss-falls-from-platform-problem-code-with-meowbit/2109/7 "2020-05-19T07:59:34Z")

</div>

Hello Felixtsu,

do you have an example ? the code i used is to set ghost mode “on” for 100ms or less and set ghost mode “off” after. but the player falls through the wall in ghost mode…

thanks for helping me.

---

<div class="post-metadata">

**Author:** ![felixtsu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/felixtsu/32/12024_2.png) [@felixtsu](https://forum.makecode.com/u/felixtsu)\
**Post date:** [May 20, 2020, 11:44am UTC](https://forum.makecode.com/t/boss-falls-from-platform-problem-code-with-meowbit/2109/8 "2020-05-20T11:44:43Z")

</div>

Hi, sorry for the late reply.

The idea is

1. use a variable, say ‘spriteGhostMode’ to mark the ‘spriteGhostMode’ on/off for a given sprite;
2. for every onOverlaps event handler and overlapsWith() method call, check ‘spriteGhostMode’ first, eat the event / return false when ‘spriteGhostMode’ is on;
3. after given period of time, automatically set the variable to off.

No. 3 is a little bit hard to do in blocks, since there’s no threading blocks available.

I’ve written a helper block to do the trick.  
 ![Screen Shot 2020-05-20 at 7.44.12 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/1X/9ea7ec176e6683f893f6ee2a28c359226daf8eca.png)

In the given period of time, all onOverlaps event handlers are eaten. **Problem is that I can’t intercept Sprite.overlapsWith, so the forever loop handling BOSS collision is needed to change**.

> **[felixtsu/pxt-spritelife](https://github.com/felixtsu/pxt-spritelife)**
>
> Contribute to felixtsu/pxt-spritelife development by creating an account on GitHub.

Check out the partial fix, when the player collides with a minion, it goes in ‘spriteGhostMode’ for 2 seconds, some animation should be introduced for better indication.

> **[JUMPJUMPLAND.sprite.ghost\_mode](https://arcade.makecode.com/48982-25536-79989-05124)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Hope it helps.

---

<div class="post-metadata">

**Author:** ![Bilu](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@Bilu](https://forum.makecode.com/u/Bilu)\
**Post date:** [May 24, 2020, 5:42pm UTC](https://forum.makecode.com/t/boss-falls-from-platform-problem-code-with-meowbit/2109/9 "2020-05-24T17:42:28Z")

</div>

> [@felixtsu](#):
>
> ![](https://pxt.azureedge.net/blob/e9dfde3b71399a21bd1f586efa4748d0fa6775a0/static/logo.svg)
> 
> ### [JUMPJUMPLAND.sprite.ghost\_mode](https://arcade.makecode.com/48982-25536-79989-05124)

Wow, it’s cool !  
i’m not able to write those kind of blocks. Thank’s a lot for your help.  
Question. why do the same with the minions ?
