Attribute for time played

reddotincreddotinc Member Posts: 653
edited November -1 in Working with GS (Mac)
This is aimed at TSB (Star Daze HD) but I'm sure others might be able to help :)

I'm looking at trying to record the amount of time played on my game within attributes, and was just wondering the best way of doing this? I've got a couple of ideas in my head, passing numbers between seconds, minutes, hours, but was wondering how other people may have implemented this?

Thanks

Comments

  • PhoticsPhotics Member Posts: 4,172
    There's the game clock. So, just keep track of that with another attribute. The game played generally does not equal the total time the game is running. But if you start and stop the tracking at the right times, you can create a nice game clock.
  • reddotincreddotinc Member Posts: 653
    Ahh I do remember seeing that!.. But recording the time wasn't my issue, more the best way to convert the real into a time value?
  • RHRH Member Posts: 1,079
    Could just create an attribute and every 1 second change it to +1. You can manage that depending on the scene or create some rules so you can specify when someone is actually playing, rather than just reading instructions. Save and load the attribute as well.

    It may damage your frame rate though, not too sure.
  • reddotincreddotinc Member Posts: 653
    That is exactly what my plan was, to just set a timer to update every 1 second while the game is in play, and then convert that to hours:mins:seconds but don't know if that is the easiest/best way to do it
  • PhoticsPhotics Member Posts: 4,172
    swiftmedia said:
    don't know if that is the easiest/best way to do it

    Heh... I just told you the answer.

    Using (game.Time) just monitor the start and stop points. That's what I did for the Photics: Toolbox - the stopwatch. Instead of adding a timer, I added some attributes and rules.

    The attribute stores the total time passed while the game is in play. You can then convert the information into something more pretty when you want to display it.
  • reddotincreddotinc Member Posts: 653
    Photics said:
    Heh... I just told you the answer.

    Using (game.Time) just monitor the start and stop points. That's what I did for the Photics: Toolbox - the stopwatch. Instead of adding a timer, I added some attributes and rules.

    The attribute stores the total time passed while the game is in play. You can then convert the information into something more pretty when you want to display it.

    LOL, i must not be explaining myself well enough.. I KNOW exactly how to record the information that I need, just not sure the best way to take that data and display it as time :P
  • PhoticsPhotics Member Posts: 4,172
    Oh, well... ha... that is tricky.

    It involves math... as the game time just keeps counting. It doesn't care about hours and minutes.

    You could use rules...
    If recorded time = 60
    change recorded time to -60
    change minutes to +1

    There might be a more elegant approach, but that's the general idea I'm thinking of.
  • reddotincreddotinc Member Posts: 653
    Photics said:
    Oh, well... ha... that is tricky.

    It involves math... as the game time just keeps counting. It doesn't care about hours and minutes.

    You could use rules...
    If recorded time = 60
    change recorded time to -60
    change minutes to +1

    There might be a more elegant approach, but that's the general idea I'm thinking of.

    That's what I was thinking too, then I was wondering how it would best to show zeros in single digit instances.. I could probably get it working even if it took me ages, but the reason for this topic was to see if TSB would be kind enough to share his method :)
  • PhoticsPhotics Member Posts: 4,172
    You could use custom fonts and then you set each digit.

    Heh... that seems like a serious resource hog though.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    I have a Time demo that explains various ways to show time. It's under my profile. Feel free to dig through it.
  • reddotincreddotinc Member Posts: 653
    firemaplegames said:
    I have a Time demo that explains various ways to show time. It's under my profile. Feel free to dig through it.

    Perfect!!! Thank you, I will be sure to check that out :DDD
Sign In or Register to comment.