Time high score
Hi everybody...
I'm trying to have a time score for my game, to be honest i am really confused about the way that i should do it.
I want to have a timer that starts when i press a button, then i want to pause the timer when i pause the game, after
this, and when the conditions are valid (a ball enters the target), i want to stop the timer, an have-display the time score, and if this time is better than all the previews saved times, to save it and display the new high score (per stage).
I would appreciate any help.
cheers
George
I'm trying to have a time score for my game, to be honest i am really confused about the way that i should do it.
I want to have a timer that starts when i press a button, then i want to pause the timer when i pause the game, after
this, and when the conditions are valid (a ball enters the target), i want to stop the timer, an have-display the time score, and if this time is better than all the previews saved times, to save it and display the new high score (per stage).
I would appreciate any help.
cheers
George
Comments
I use a separate actor that I call timer and use the actors time function. The time function starts when the actor spawns and ends when it destroys.
Make a start button and spawn a new actor called timer when you press the start button. If you paus the game the time also stops and when you unpaus the game the time continues.
When you want to stop the timer and save it make a rule who change an new attribute to the timer actors time and then destroy the time actor.
For ex.
IF "target hit" = 0
then
change "attribute1" to "timer actors time"
and destroy timer actor
I don't know if this helps but feel free to ask again if you need.
//
J
So, now...to save for each scene the best time, i have to use tables or this could be done by saving behavior?
To save the time for each level i would do like this.
Create a table whit as many rows as your game has levels. In the first col you write a high number such as 999 for each row.
Create a attribute and call it level. Make a rule and increase the level attribute for each new level the player plays.
When the level is completed and you know what time the player got. Make a rule and check if the players time is better than the time in the table for the row corresponding to the right level. For ex. row one is level one and row two is level two and so on.
If the time is better then write the new value to the table.
If you use the level attribute you can use the same rule for all the levels and use the level attribute as the row counter in the table statement.
//
J
try the downloaded template on the Gamesalad popup page, the timer
Tshirtbooth's tutorials are very clear, so following his directions everything worked fine.
thanks everybody for the assistance.