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! :)



1

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
 jump()
end
🅾️_was_down=btn(🅾️)

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

Wiki


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



[Please log in to post a comment]