Game Maker's Garage Forum

Game Creation => GameMaker => Topic started by: Zoo on April 05, 2011, 08:19:40 PM

Title: command time!
Post by: Zoo on April 05, 2011, 08:19:40 PM
How would I make a command happen every second?
Title: Re: command time!
Post by: Gan on April 05, 2011, 09:33:19 PM
Set a timer for each second?
Title: Re: command time!
Post by: Zoo on April 06, 2011, 03:33:07 PM
I thought there was only one timer, so having all of them wouldn't work. But i'll check.
Title: Re: command time!
Post by: Zoo on April 06, 2011, 03:35:49 PM
Yeah, if a code is like
ON TIMER 100 PRINT 1
ON TIMER 200 PRINT 2
ON TIMER 300 PRINT 3
It just does the last one.
Title: Re: command time!
Post by: EqwanoX on April 06, 2011, 06:35:11 PM
you can only have one timer, so you have to use varaibles withiin the timer to emulate multiple timers like this

on timer 1
let timer1+=1
let timer2+=1
let timer3+=1

if timer1=100 then
if timer2=200 then
if timer3=300 then

end timer
Title: Re: command time!
Post by: Zoo on April 07, 2011, 03:13:53 PM
Eq, something tells me you are in the world of SC. The "lets" and the no spaces between the numbers and the + - =.
Title: Re: command time!
Post by: Al Staffieri on April 07, 2011, 08:45:37 PM
EQ is writing in SC, but the idea is the same.


ON TIMER 100
  mytimer = mytimer + 1
  IF mytimer > 3 THEN mytimer = 1
  SELECY CASE myTimer
    CASE 1
      ' do this after 1 second
    CASE 2
      ' do this after 2 seconds
    CASE 3
      ' do this after 3 seconds
    END SELECT
END TIMER

Title: Re: command time!
Post by: Zoo on April 08, 2011, 02:18:41 PM
Great. I used this to make a pet-sim.
http://www.mediafire.com/?2p62qtefv764mpm