Problem with timer :(

beaudoin_nbeaudoin_n Member Posts: 184
edited November -1 in Working with GS (Mac)
Hi

I want to track the gameplay time and display it to the user.

Simple object
rule
when attribute game.end is false and game.pause is false
timer every 0.01 seconds run to completion
change attribute game.timer to game.timer+0.01
end rule
display text game.timer

looks ok right??
But somehow it is way slower than it should be:(

thanks for your help

Comments

  • beaudoin_nbeaudoin_n Member Posts: 184
    Yeah but that won't put it on hold when the player hits pause :(
  • beaudoin_nbeaudoin_n Member Posts: 184
    Hi blouseguy (hey i have to have fun with names too :P)

    what does the startround stand for ? When is it updated ?

    Thanks
  • beaudoin_nbeaudoin_n Member Posts: 184
    Also raises the question of object attributes versus game attributes... is there anything related to performance ?
  • beaudoin_nbeaudoin_n Member Posts: 184
    K i think it works.... but the thing is i'd like to see this timer incease every 0.01 seconds...

    updating it on screen so the user knows if he's gonna beat his score
  • beaudoin_nbeaudoin_n Member Posts: 184
    bump
  • beaudoin_nbeaudoin_n Member Posts: 184
    Heeeeeeeeelp!

    ;)
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I guess you shouldn't have called him blouseguy!

    ;-p
  • beaudoin_nbeaudoin_n Member Posts: 184
    Ok I am sorry I am not worthy!!!!!

    Tshirtbooth is the master
    Tshirtbooth is my new god
    Tshirtbooth's name will never be made fun by me
    And I promise that when I see someone mess up his name I will correct them and let them know they should pay proper respect to the man!!!

    K now Tshirtbooth ... Please help a fellow Canadian ;)
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    hah!
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    I thnk the problem with your original code is you were dong it every .01 seconds, I read somehwere, maybe the wiki, that if you have a repeating timer don't go under .1
  • synthesissynthesis Member Posts: 1,693
    Is there a good reason why you are tracking 1/100th of a second in your game clock? Seems like game times really only need to report on a 1 second count.

    I use a seconds timer only.

    I have an invisible actor called time tracker.
    Then I set the start time (either 0 seconds or 300 seconds (for 5 minutes) or whatever)

    Then have a timer in the tracker actor that changes the gameTimeSeconds value to itself + or - 1 and is constantly running until gameOver = true (which could be when the game time = 0).

    After that, you have a clock timer running in the game.

    Then you create a timeDisplay actor and constrain the gameTimeSeconds value into it and do some math calculations on it to display it how you wish.

    I use graphic fonts of the digits...So I then have 4 unique actors that report each place digit in the clock value and then change the image to match the place digit value....which gives me a clock capable up to 99 minutes and 59 seconds.

    The tricky digit to calculate is the ten second place...since you have to adjust the place value for a 60 value reset loop rather than a 100 value loop like you would in a score tracker.

    Make sense?
    FMG has done some clock sample tutorials if you search for it in the web games archive.
    Its not that hard...just takes some thought and trial and error. It took me a day to work through the exercise and build one from scratch...but now I have one...forever...and it works really well.

    Now if only gameSalad would allow you to make a personal actor archive library to drag and drop pre-designed actor setups into your game. I have tried drag importing actors in from other games...but it seems to crash GS every time and/or corrupt my game...so I don't trust importing actors from other sources anymore.
  • synthesissynthesis Member Posts: 1,693
    And its stuff like that TSB that irks me about GS. Hopefully they will have typical/expected capability such as drag and drop actors from place to place (or from a personal library) introduced soon...at least by version 1.5.

    This could make actor archive/sharing depositories VERY useful...as it is in many other software types (such as Flash).
  • beaudoin_nbeaudoin_n Member Posts: 184
    For my game levels will be 15 seconds or less, and the faster you play you can beat your score by hundreth of a second.. So that's why I set it up like so.

    Now if I can't have it displayed(refreshed) while they are playing well then maybe I'll remove the timer aspect all together and it will be a pass/fail level or I'll just show them their time at the end
Sign In or Register to comment.