Page 1 of 1
Timing in a basic game
Posted: Sat Apr 25, 2009 12:19 am
by JasonTravers
Hello. I'm creating a basic educational game with music, sound effects, visual effects and a automatic timer. I would like the user to manipulate objects on the screen to produce sound/visual effects while a player plays music. I want the stack to advance the use to the next card after a specified period of time, but can't quite figure out how to run a timer while allowing the user to perform actions.
Also, variables are counting correct and incorrect responses. Any advice for a newbie?
Thanks!
Posted: Sat Apr 25, 2009 12:28 am
by SparkOut
You will probably need to look at "send" (in <time>) constructions.
For example if you have a sequence of cards that you need to advance after a time limit, as you say, you could make a stack script that has the handler
Code: Select all
on advanceCard
go next card
end advanceCard
Then when you need to initiate an event timer (say on cardOpen) you can do something like
Code: Select all
on cardOpen
send "advanceCard" to me in 30 seconds
end cardOpen
That means that when the card with the cardOpen script is opened, it will put a message in the pending messages queue that will activate in 30 seconds. That message will then arrive in the stack script and trigger the advanceCard handler, which will "go next card".
If that's not clear enough, let me know, but HTH.
Posted: Sat Apr 25, 2009 9:21 am
by malte
Hi Jason,
I wrote quite a bit about timing in the past. My free eBook for Mac and Windows is still available (even though it is a bit dated)
For Windows:
http://downloads.runrev.com/revselect/a ... ls_win.zip
For Mac:
http://downloads.runrev.com/revselect/a ... ials_x.zip
Hope that helps a bit.
Malte
Timing in a basic game
Posted: Mon Apr 27, 2009 4:30 pm
by JasonTravers
Lovely!
Thanks for the tips. I knew there had to be a easier way than what I was doing (using several "if, then" scripts.
Cheers!
Jason