How to track event "not moving" ?

A

Antera

Guest
Hello,

I just finished the tutorial DND arena shooter, Game Creator Studio 2 is wonderful and I already forgot all other game creators !

I'd like to track when the player is not moving
I set up var moving = 0 on create event
And var moving = 1 when key down left/right/up/down

What is the event to track to set back moving to 0 when player is not moving ?

Many thanks for your help
 

Attachments

A

Antera

Guest
Update : I succeeded with an alarm, yeah !

Solution : when move (keydown), set alarm to 30 for example
Then event alarm your action, set cooldown alarm
 
You don't necessarily need an alarm, you could just track the differences between x and y with xprevious and yprevious. If both sets match, the player isn't moving. By paying attention to coding and event order, you could also set moving to 0 before they key checks, which would set it to 1, and then use the variable afterwards for whatever its purpose is.
 
Top