How to save and load a non-attribute?

0belisk0belisk PRO Posts: 189
edited November -1 in Working with GS (Mac)
On my game the aim is to complete the test as fast as possible. i have a timer in the corner which displays minutes, seconds and milliseconds, once the game is completed, how do i save the time it took the player to complete the game, then display that number later on, e.g. main menu highscore.

im using "floor(floor(( self.Time %3600)/60)/10)..floor((floor( self.Time %3600)/60)%10)..":"..floor(( self.Time %60)/10)..floor( self.Time %10)..":"..(floor( self.Time *10)%10)..floor(floor( self.Time *100)%10)" to display my timer, incase your wondering.

Thanks

Comments

  • 0belisk0belisk PRO Posts: 189
    bump.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    you have to create an attribute to track the time. and then use save an load on that. Using a timer do

    every0.1
    change attribute self.playtime to self.playtime+0.1
  • 0belisk0belisk PRO Posts: 189
    Thanks for the input :), however that didnt work,

    i fixed it by making a global attribute instead of a self attribute.

    also when using +0.1, the value doesnt change. it says on 0 and doesnt go up. to fix this issue i made it every 0.1 seconds, increase the value by +1 instead of 0.1.

    then when displaying the final figure at the end, i did display: game.timetracker/10 so it returned the number to its appropriate value.
Sign In or Register to comment.