P
potatato
Guest
I've simplified it, but it's basically what I am trying to do.
When a user presses a key it changes the state to idle and command to stop.
Step Event
Alarm[0]
What actually occurs (found by debug message):
Alarm[0] counts down from 300 (60*5). The alarm does go off and the state and command are set correctly back to move and go respectively.
BUT then in the step event it goes to case "idle" and goes to "stop" again, which goes into an infinite loop. How do I make my step event respect my alarm frame?
When a user presses a key it changes the state to idle and command to stop.
Step Event
GML:
switch(state) {
case "idle":
if (command == "go") {
// do stuff
} else if (command == "stop") {
if(alarm[0] < 0) {
alarm[0] = room_speed * 5
}
}
break;
case "move":
//do moves
break;
}
GML:
state = "move"
command = "go";
What actually occurs (found by debug message):
Alarm[0] counts down from 300 (60*5). The alarm does go off and the state and command are set correctly back to move and go respectively.
BUT then in the step event it goes to case "idle" and goes to "stop" again, which goes into an infinite loop. How do I make my step event respect my alarm frame?
Last edited by a moderator: