GameMaker How do I move an object forever? (SOLVED)

K

komodolies

Guest
So, I have an object named objTitle, and I want to basically move 8px up by the y axis, wait 15 steps, move 8px up by the y axis, wait 15 steps, Then, move 8px down by the y axis, wait 15 steps, move 8px down by the y axis, then repeat. I want this to loop forever. Yes, I know I could do this with manipulating the y variable, but how could I do this forever? Thanks!
 
K

komodolies

Guest
I'm fairly new to GML, sorry if this is an amateur question, but what do you mean by a timeline?
 

JackTurbo

Member
You could also use an alarm and a counter variable.

Initialise the counter to zero and the alarm to 15 in the create event.

Then in the alarm event use either a state machine or if checks against the counter variable to do the correct action. Then ++ the counter and reset it to zero if it now equals 4 or greater. Then reset the alarm to 15.
 

pixeltroid

Member
timelines are a built in feature that lets you set how an object behaves over a time period/.

It requires some calculations, but you can make your object move the way you want as per your requirements!
 
K

komodolies

Guest
You could also use an alarm and a counter variable.

Initialise the counter to zero and the alarm to 15 in the create event.

Then in the alarm event use either a state machine or if checks against the counter variable to do the correct action. Then ++ the counter and reset it to zero if it now equals 4 or greater. Then reset the alarm to 15.
I understood everything except "or to use if checks 'against' the counter variable to do the correct action."
What do you mean?
 
Top