How to detect when a player walks off a tile?

FunnyLucky

  • Posts: 8
The problem is pretty simple, yet I couldn't find a solution that fits my case.
My player is allowed to jump if he has contract with ground. Good. If he jumps, after 0.03s his Jump is set to Off.
But if a player walks off a tile and starts falling down, I have no check for that. At any point during the freefall you can press up and end up with an mid-air jump.
This question is bugging me for like a month and when I thought I found some solution, it doesn't work in this scenario. Any help welcome!

corbanwolf

  • Posts: 161
You need to check if player is currently colliding with tiles. (bottom of actor to be precise)
-how to detect end of collision:
   -when actor collides:
      -set TEMP TOUCH true,
   -when updating:
      -if TEMP TOUCH == true:
         -set TOUCH true,
      -otherwise:
         -set TOUCH false,
      -set TEMP TOUCH false,

Collision events are always executed before other events.

FunnyLucky

  • Posts: 8
When I started making my game, Abigayl's tutorials were my go-to for help. Because of this, my Jump (TOUCH in your example) is not a Boolean Attribute, but a Text one. Is there any workaround if I did this?

vicevicebingo

  • Posts: 40
yeah, y-speed becomes minus
is useless to leave the collision of tiles.

yeah, when collision happens isnt
the chance to set ______ to ______.

yeah, within when updated,
if block isnt automatally
checking  if _______ otherwise ________
to set _____ to _____. if block is just for
once use, not forever.  you cant make 1 jump
after the first 0.001 second.
if + otherwise cant make 2 ways choice
when there is an attribute, too.

use over 1 attributes can be
harmful to human's brain
as using 4 keys to control player yeah.


corbanwolf

  • Posts: 161
What do you mean it's a text attribute. Just convert my code to be suitable with yours. Use text attributes instead of my boolean ones. The logic and code structure is the same

Bombini

  • *
  • Posts: 1263
You could also check if a tile exists below the player but i dont know if that meaningful in your game.