# Bug in Makecode or Bug in \*my\* code

**URL:** <https://forum.makecode.com/t/bug-in-makecode-or-bug-in-my-code/37699>\
**Category:** Help\
**Tags:** game\
**Created:** [July 1, 2025, 5:54pm UTC](https://forum.makecode.com/t/bug-in-makecode-or-bug-in-my-code/37699 "2025-07-01T17:54:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rubberducky271](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/rubberducky271/32/9685_2.png) [@Rubberducky271](https://forum.makecode.com/u/Rubberducky271)\
**Post date:** [July 1, 2025, 5:54pm UTC](https://forum.makecode.com/t/bug-in-makecode-or-bug-in-my-code/37699/1 "2025-07-01T17:54:02Z")

</div>

I want to make my person step on a tile and fade to black then teleport them. when I do the code, it instead only triggers afte rthe player overlapped then leaves that tile.

---

<div class="post-metadata">

**Author:** ![mmurray1019](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mmurray1019/32/23334_2.png) [@mmurray1019](https://forum.makecode.com/u/mmurray1019)\
**Post date:** [July 1, 2025, 7:49pm UTC](https://forum.makecode.com/t/bug-in-makecode-or-bug-in-my-code/37699/2 "2025-07-01T19:49:37Z")

</div>

If you post the link someone can take a look at it

---

<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:** [July 1, 2025, 7:49pm UTC](https://forum.makecode.com/t/bug-in-makecode-or-bug-in-my-code/37699/3 "2025-07-01T19:49:52Z")

</div>

Please send your code! I have never had this issue before, so it’s most likely an issue with your code.

---

<div class="post-metadata">

**Author:** ![Rubberducky271](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/rubberducky271/32/9685_2.png) [@Rubberducky271](https://forum.makecode.com/u/Rubberducky271)\
**Post date:** [July 1, 2025, 10:39pm UTC](https://forum.makecode.com/t/bug-in-makecode-or-bug-in-my-code/37699/4 "2025-07-01T22:39:50Z")

</div>

> **[nsn](https://arcade.makecode.com/S49422-74750-99930-12402)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<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:** [July 2, 2025, 5:11pm UTC](https://forum.makecode.com/t/bug-in-makecode-or-bug-in-my-code/37699/5 "2025-07-02T17:11:34Z")

</div>

This is because at the start of the fade function, it sets the current palette to that first one over and over again, as well as canceling any other fade effects that are happening, so basically it is repeatedly restarting the fade effect. You’ll have to use a variable to keep track or a long Pause block after.

---

<div class="post-metadata">

**Author:** ![Stickman4269](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/stickman4269/32/23582_2.png) [@Stickman4269](https://forum.makecode.com/u/Stickman4269)\
**Post date:** [July 2, 2025, 5:29pm UTC](https://forum.makecode.com/t/bug-in-makecode-or-bug-in-my-code/37699/6 "2025-07-02T17:29:50Z")

</div>

The issue is that the “overlaps tile” event happens every frame that the condition is true, so the fade constantly resets. [use this extension to activate it at the start of the overlap only](https://github.com/riknoll/arcade-sprite-events)

---

<div class="post-metadata">

**Author:** ![mmurray1019](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mmurray1019/32/23334_2.png) [@mmurray1019](https://forum.makecode.com/u/mmurray1019)\
**Post date:** [July 2, 2025, 5:33pm UTC](https://forum.makecode.com/t/bug-in-makecode-or-bug-in-my-code/37699/7 "2025-07-02T17:33:14Z")

</div>

It seems that your problem is that it is repeatedly trying to call the fade, and with each call it restarts the fade. For example, if you are on the tile, step off, and then step back on, it will stop fading when you step on.  
To fix this, you just need to assign a variable in an if statement so that it can only be called once.  
I think i did a bad job of explaining this so I also edited the code for you.  
Here you go:

> **[nsn](https://arcade.makecode.com/S28981-24042-87880-47954)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.
