[Solved] Collision only when player jumping/moving up

Any advice on having a player only collide with an object when the player is jumping up or moving upwards? I have set the condition so that both the collision and “is jumping” have to be true before the action takes place…but it’s also happening when the player is falling. There is a warning within GDevelop that sometimes jumping/falling can register as the same this depending on the speed of the jump/fall, so I think this might be the culprit?

Specifically, I want a coin box to be hidden, and only when the player jumps up from the bottom and collides with it then it appears. If the player collides with it while falling down, then I want the player to pass through it as though it’s not there. I’ve got this working, and if the player is falling from a bit of height it passes right through…but if its falling from a short distance then it reveals the coin box (and therefore the game thinks it’s meeting the “is jumping” condition somehow).

Implement this yourself I guess. Use two variables, a isJumping one and oldY. Make sure the events for oldY are before the ones that use isJumping. The event for oldY is basically if oldY is lower than current Y then the player is jumping, set isJumping to 1. If oldY is equal or bigger than the current Y value, set it to 0. Whatever happens just after that set oldY to the current Y value. Then to test if it is jumping use the condition if isJumping I equal to 1.

Thank you! I had to do some more research on OldY/OldX, but I got it working. Didn’t even need the “isJumping” variable as you suggested.

It still triggers if the player is colliding with the invisible box from the sides while moving up, but I can live with that. I tried adding a condition of "player’s Y position has to be greater than the bottom of the box…but that just made nothing work. Perhaps some more tweaking is in order, but overall OldY works.

1 Like