I think I’m just stupid but level 3 and four keep overlapping and i don’t know how to fix it. pls help.
Hi! I think the reason Levels 3 and 4 are overlapping is because they’re using the same tilemap or not resetting it between levels.
To fix this, you can:
- Create a separate tilemap for each level.
- When you change levels, use a “set tilemap to…” block for that level’s specific map.
This way, each level has its own map and they won’t overlap anymore.
If you want, I can show you how to organize them so it’s easier to manage many levels.
I tried the idea of using the “set tilemap to” block but it still overlaps so i don’t know whats going on. pls show me how to manage the levels easier.
Ah, the reason why level 3 had bugs was mainly because of Aa few tips for fixing it without rewriting code:
- Check the tile placement:
Go into the tilemap editor and make sure the tiles for level 3 and 4 don’t physically occupy the same space. Even a one-tile overlap will trigger both events. - Use
sprites.destroy()
or flags:
If some tiles or sprites should only exist in one level, destroy or hide them when moving to the next level. Like you did inLevel_4()
, where you destroyHOOOOOOOOLE
sprites. Make sure level 3’s special tiles/sprites are cleared before level 4 starts. - Level flag variables:
You can add a simple boolean flag likecurrentLevel = 3
orcurrentLevel = 4
and then inside the overlap events, check that flag before doing anything. Example with blocks logic:
if currentLevel == 3:
do overlap stuff for level 3
else if currentLevel == 4:
do overlap stuff for level 4
Basically, the overlaps are firing because MakeCode doesn’t know the player is in “level 3” or “level 4” if the tiles from both levels exist at the same coordinates. Fixing the tile placement or adding level checks usually solves this.