Jumping up through platform and landing on it

Have a student who wants their character to be able to jump up through a platform on screen from underneath, and then land on it. I was able to get the basic interaction working by saying "If the tile above the player is THIS tile (a specific tile for the platform), then set the wall flag to off on the tile above the player. AND Elif the tile below the player is THIS tile (same specific tile), then set the wall flag to on on the tile below the player.
That DOES work. However, we run into issues when the sprite is between two tiles. If they aren’t perfectly centered beneath the tile when they jump up, it won’t let them pass through.

Can anyone think of how I can modify it so that it will also allow pass through if the tile to above and to the left or right is the same tile as well as the one above, then it will turn the wall flag off for those tiles? Or I guess if the tile above the player is that specific tile, to turn off the wall flag on all three tiles, above, above to the right and above to the left? And then turn them back on?

Any help would be appreciated!

1 Like

try this!

2 Likes

Oh, that’s interesting. I like the approach. One question tho… if I’m reading htis right, it’s going to set ALL platform tiles above the player to lose their wall status, and as soon as the character moves high enough, will turn the wall on.

Won’t that prevent the student from setting enemies on any platforms above the player?

2 Likes

You should be able to use the “tilemap location of (mySprite)” block in the Scene tab to get the tilemap position of your player sprite, then you can use the Set Wall block to (if they are that type of tile) set the walls Off of the three tiles above the player. The main problem is how to turn the walls back on. I think one solution would be to set wall On for all of those blocks that are below the player, and the pass-through script could run only when the player jumps. Then, to make sure no walls get left off, you could have a script to turn all walls On whenever the player is hitting the ground (when their Velocity Y = 0) just to resolve any edge cases.

1 Like

oh yeah, didn’t think of that. you could do something like this:

it’s a bit buggy, and isn’t actually very good, but I’ve never done enemies on semisolid ground.

1 Like

you might want to read this thread

While it might be a bit buggy still, I think I’ve got something that will work well for this student! Appreciate both of you sharing your suggestions!

glad i could help :grin: