|
Post by kempston on Jan 4, 2019 17:22:38 GMT
Hi !
How could I detect the main sprite is not moving or has not been in motion for a few seconds ? My aim is to add some animation when the player is still for a while.
Thanks in advance for any suggestions.
|
|
|
Post by highrise on Jan 5, 2019 13:48:02 GMT
hi Kempston
Try this:
in sprite initialisation:
IF TYPE=0 LET PARAMB 0 ENDIF
in sprite event:
IF PARAMB > 0 SUB 1 to PARAMB
IF PARAMB=0 ;put your code here for a one off animation or action ENDIF ENDIF
IF PARAMB=0 ;put your code here for an event that will happen all the time when the player stops for a while
ENDIF
IF KEY 0 LET PARAMB 50 ;set this for all keys ENDIF
IF KEY 1 LET PARAMB 50 ENDIF
|
|
|
Post by kempston on Jan 5, 2019 21:56:37 GMT
It works !!! Thank you so much highrise !
Regards :-)
|
|
|
Post by highrise on Jan 6, 2019 3:21:58 GMT
no problem - you might also want to add a check for if the sprite is in the air as the sprite could be moving with no key pressed in this instance.
|
|
|
Post by kempston on Jan 6, 2019 16:49:39 GMT
Hm, you're right again.
In the game I'm working on, there are only two screens where the player has to jump platform-like. And I'm beginning the design now so I'll have to take this into account. Or maybe increase the number to which I set PARAMB so it'll wait a bit more before changing the sprite. What do you think ?
Anyway, once more, thank you !
|
|