|
Post by dettol on May 1, 2022 12:28:13 GMT
Hi, what is the best way to tackle the jumping loop?
I don't want my sprite to keep jumping when you hold down the jump key.
I have tried delay and other things but nothing really achieves the result.
I am thinking WAITKEY for another press? if so how would I implement that?
many thanks
|
|
|
Post by luiscoco on May 1, 2022 16:53:38 GMT
Detect Ground
|
|
david911
Abandoned Uranium Working

Posts: 17
|
Post by david911 on May 1, 2022 18:49:03 GMT
an example would be great im interested.
i dont want my sprite to keep jumping when holding down the jump key. Just jump once and wait again for the key to be pressed.
|
|
|
Post by Minilop on May 2, 2022 12:50:12 GMT
IF KEY FIRE ; is the Fire key being pressed?
IF J = 0 ; if the fire key was previously off
JUMP 7 ; make me Jump to height 7
LET J = 1 ; set fire key status to on
ENDIF
ELSE ; if the fire key is released
IF J = 1 ; and fire key status is ON
LET J = 0 ; set the firekey status to OFF
ENDIF
ENDIF
Using a variable (either a local sprite variable or as in this case a global variable) to store whether the fire key has been released or not, when the fire key is released, the code after the ELSE statement will reset the variable so that the next jump can be initiated.
|
|
|
Post by dettol on May 3, 2022 9:07:40 GMT
fantastic minilop. I have been working through your tutorials, they are so under rated! excellent work!
|
|