GameMaker: Studio

GameMaker: Studio

View Stats:
Freefork Nov 18, 2016 @ 7:14pm
How do Step events work?
I believe Step events opporate every frame. However, there are times when the step doesn't do anything. It just stops working... Can someone explain Step events to me?
< >
Showing 1-6 of 6 comments
Blind Nov 18, 2016 @ 7:17pm 
A step happens every game frame, which is based on room speed.
Detonatress Nov 19, 2016 @ 5:19am 
Originally posted by Freefork:
I believe Step events opporate every frame. However, there are times when the step doesn't do anything. It just stops working... Can someone explain Step events to me?
The step event will repeat an action for as long as the conditions in the if statement (if there is one) are met. If there is no if statement, it will continue to repeat the action forever unless the object its actions refers to is gone (this gives you an error because you have no if statement to check if the object exists), or the object containing the step event is gone.

Alarms can be used to reduce the work the CPU has to do per frame.
Some actions that you don't need every frame can be set to an alarm that repeats itself every 2 frames or more, it all depends on how much waiting time you can afford to have for a particular set of instructions.
Last edited by Detonatress; Nov 19, 2016 @ 5:20am
Freefork Nov 19, 2016 @ 5:19pm 
Originally posted by Detonatress:
Originally posted by Freefork:
I believe Step events opporate every frame. However, there are times when the step doesn't do anything. It just stops working... Can someone explain Step events to me?
The step event will repeat an action for as long as the conditions in the if statement (if there is one) are met. If there is no if statement, it will continue to repeat the action forever unless the object its actions refers to is gone (this gives you an error because you have no if statement to check if the object exists), or the object containing the step event is gone.

Alarms can be used to reduce the work the CPU has to do per frame.
Some actions that you don't need every frame can be set to an alarm that repeats itself every 2 frames or more, it all depends on how much waiting time you can afford to have for a particular set of instructions.

Okay, thanks for that response! That might explain how to remove some lag issues.
Detonatress Nov 19, 2016 @ 6:01pm 
Originally posted by Freefork:
Originally posted by Detonatress:
The step event will repeat an action for as long as the conditions in the if statement (if there is one) are met. If there is no if statement, it will continue to repeat the action forever unless the object its actions refers to is gone (this gives you an error because you have no if statement to check if the object exists), or the object containing the step event is gone.

Alarms can be used to reduce the work the CPU has to do per frame.
Some actions that you don't need every frame can be set to an alarm that repeats itself every 2 frames or more, it all depends on how much waiting time you can afford to have for a particular set of instructions.

Okay, thanks for that response! That might explain how to remove some lag issues.
Also, be careful when creating objects using Step.
If it has no condition such as "If this object does not exist, create it" then it will continue to create it and drain resources like crazy.
Last edited by Detonatress; Nov 19, 2016 @ 6:01pm
SquishNoob Nov 20, 2016 @ 7:18pm 
also destroy objects you wont be using anymore... like bullets that fly off the screen... otherwise they fly away and take your ram with them.
Freefork Nov 21, 2016 @ 5:02am 
Originally posted by SquishNoob:
also destroy objects you wont be using anymore... like bullets that fly off the screen... otherwise they fly away and take your ram with them.

Yea, I'll always remember to do that!
< >
Showing 1-6 of 6 comments
Per page: 1530 50

Date Posted: Nov 18, 2016 @ 7:14pm
Posts: 6