Timer score
PixelPun
Member Posts: 324
I just need a simple timer that will count up as a high score. I have looked all over the forums but haven't been able to find one. The score will be the time the actor stays alive... so it needs to count up automatically.... any help would be greatly appreciated.... thanks.
Comments
Then inside that clock actor...
Create an attribute (integer) called "timeKeeper"
Create a game boolean attribute called "stopTime"
Then in the actor behavior builder...have the following:
display text self.timeKeeper
Rule: When self.stopTime = False
Constrain attribute self.timeKeeper to floor(self.Time)
This will tie the actors internal clock to an integer value. The floor just rounds it down to remove decimals.
Then in the game...change game.stopTime to True with the game is over...which will freeze the time.
Note:
This will only track a seconds count. You will need to do some other arithmetic to get it to read minutes and seconds...and there are demos on how to do that.
@Mateen...
Spawning every .1 seconds to track a time is very inefficient and not the best way to go. Try something like above.
timer every 1 second
change attribute score to score+1
You can then use the custom fonts template or display.text rule to display the figure as the time/score.