How to timer score

Jaws206Jaws206 Member, PRO Posts: 19

Hello Everyone,

I’ve come unstuck in completing my game and that is setting up a timer score to my levels. I would like to set up a timer to record how quick a player could finish a level and record it as the best time, till another player beats it.

I’ve searched all over the forums and youtube videos but no luck, may be I’ve come across this information but not knowledgeable enough to recognize it’s what I want.

I would really appreciate it if someone could please help me out with this in a little bit of detail on how to go about this. I have difficulty in understanding stuff if it’s not put out in step by step process.

Thank,
Gerard

Comments

  • gingagaminggingagaming FREELANCE GS DEV Member Posts: 1,685

    All you need is make an integer attribute called second and them make an actor and put the timer behaviour inside it saying ever 1 second change attribute game.second to game.second +1. This will then count the seconds.

    Then make another attribute called best score. And have the rule, if game.second is more than game.bestscore change game.bestscore to game.second

  • Jaws206Jaws206 Member, PRO Posts: 19

    Gingagaming,

    You are just awesome; finally I can start to put the finishing touches to my game, thank you very much.
    Gerard.

  • IMakeGamesLikeThisIMakeGamesLikeThis Beaverton, OregonMember Posts: 64
    edited June 2014

    This somewhat helps me, but Jaws206 wants it done per second. What if I want mine done per 10 milliseconds, which is a centisecond (a hundredth of a second (0.01 seconds))? The way I had it is this: Every o.o1 seconds, change attribute game.second +0.01. However, this did nothing. Did I get something wrong?

    EDIT: I think I found the problem. When testing with different settings, I found that instead of creating an "integer attribute called second," creating a "real attribute" called second worked for me. When I attempted this with an integer attribute, the number stayed at 0 unless I changed the timer to either "every 1 second" or "every o.1 second" (I found this out by having an actor that I called time in view during gameplay and had it display the second attribute). However, I think that GameSalad isn't capable of having a timer that goes any faster than a millisecond (o.1) because each time I attempted this with the timer set to "every 0.01 seconds" it took approximately 2 seconds to add 1 second to the time when increasing the time by 0.01 seconds, which means that it was still set at 0.1 seconds instead of at 0.01 seconds. I further tested this hypothesis out by setting the timer to "every 0.000000000000000000000000001 seconds" which reverts to "1E-27." I noticed that the time did not add 0.01 seconds to the time any faster than it did when adding 0.01 seconds every 0.01 seconds. I'm surprised at this because I would think that any game development software should at least be capable of centiseconds, since a lot of stopwatches use those. Furthermore, speed runs are also timed using centiseconds or even milliseconds. Since I am making my game capable of speed runs, I would like to have the correct time intervals, but I'd settle for deciseconds (o.1 seconds) for now. The developers of this software should improve on this, but this is just my opinion. Feel free to test this out for yourselves. I tried to be as precise as possible. :)

Sign In or Register to comment.