Log In  

So in Super Mario and similar games the character only jumps when you press the button, and if you just keep the same button press the character doesn't jump. You have to release the button and then press it again.

I've tried to implement a jump action and both with btn and btnp if I keep the button pressed the player keeps jumping forever (in btnp just slower).

How can I do this? Thank you! :)

P#63020 2019-03-25 15:02


You just need to keep track of the button's state in the previous frame yourself. Something along the lines of

if btn(🅾️) and not 🅾️_was_down then
P#63023 2019-03-25 16:26

Can you use btnp() rather than btn()?


P#64087 2019-04-30 11:50 ( Edited 2019-04-30 11:50)

Nop. With, btnp after a few frames it jumps again :(

P#64094 2019-04-30 13:12

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2023-01-29 16:11:28 | 0.005s | Q:13