Problem with timer :(
beaudoin_n
Member Posts: 184
Hi
I want to track the gameplay time and display it to the user.
Simple object
rule
when attribute game.end is false and game.pause is false
timer every 0.01 seconds run to completion
change attribute game.timer to game.timer+0.01
end rule
display text game.timer
looks ok right??
But somehow it is way slower than it should be:(
thanks for your help
I want to track the gameplay time and display it to the user.
Simple object
rule
when attribute game.end is false and game.pause is false
timer every 0.01 seconds run to completion
change attribute game.timer to game.timer+0.01
end rule
display text game.timer
looks ok right??
But somehow it is way slower than it should be:(
thanks for your help
Comments
what does the startround stand for ? When is it updated ?
Thanks
updating it on screen so the user knows if he's gonna beat his score
;-p
Tshirtbooth is the master
Tshirtbooth is my new god
Tshirtbooth's name will never be made fun by me
And I promise that when I see someone mess up his name I will correct them and let them know they should pay proper respect to the man!!!
K now Tshirtbooth ... Please help a fellow Canadian
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
I use a seconds timer only.
I have an invisible actor called time tracker.
Then I set the start time (either 0 seconds or 300 seconds (for 5 minutes) or whatever)
Then have a timer in the tracker actor that changes the gameTimeSeconds value to itself + or - 1 and is constantly running until gameOver = true (which could be when the game time = 0).
After that, you have a clock timer running in the game.
Then you create a timeDisplay actor and constrain the gameTimeSeconds value into it and do some math calculations on it to display it how you wish.
I use graphic fonts of the digits...So I then have 4 unique actors that report each place digit in the clock value and then change the image to match the place digit value....which gives me a clock capable up to 99 minutes and 59 seconds.
The tricky digit to calculate is the ten second place...since you have to adjust the place value for a 60 value reset loop rather than a 100 value loop like you would in a score tracker.
Make sense?
FMG has done some clock sample tutorials if you search for it in the web games archive.
Its not that hard...just takes some thought and trial and error. It took me a day to work through the exercise and build one from scratch...but now I have one...forever...and it works really well.
Now if only gameSalad would allow you to make a personal actor archive library to drag and drop pre-designed actor setups into your game. I have tried drag importing actors in from other games...but it seems to crash GS every time and/or corrupt my game...so I don't trust importing actors from other sources anymore.
This could make actor archive/sharing depositories VERY useful...as it is in many other software types (such as Flash).
Now if I can't have it displayed(refreshed) while they are playing well then maybe I'll remove the timer aspect all together and it will be a pass/fail level or I'll just show them their time at the end