simple jump code, but how to limit it?


  • Posts: 42
I have a simple jump code set up as follows:

when Up is pressed
push Last Created Actor sharply toward 270 degrees at 50 force

It works, but I want to disable double-jumping and limit the number of possible jumps to 1 (until the actor has collected a pellet that allows him to jump again).
I'm working on the pellet collection code right now. In the meantime, are there simple codes to help me with these 2 issues?


  • Posts: 370
set local attribute jumpCount =0

when up is pressed AND jumpCount =0 then :
increment jumpCount
push etc...

This will prevent double jumps. After a delay or when pellet collected set jumpCount to 0 which will allow a single jump again.


  • Posts: 42
thanks for the help. My character's jump is triggered when you hit the down key, & the amount of the jump force is controlled by what region another actor is in.

I discovered I could limit the number of jumps by killing the other actor after the down key event. It ain't pretty, but it works for testing purposes. Your method appears to allow the jump count to be reset, which I think I need in order for the pellets to work.