Time high score

glyniusglynius Member Posts: 231
edited July 2012 in Working with GS (Mac)
Hi everybody...
I'm trying to have a time score for my game, to be honest i am really confused about the way that i should do it.
I want to have a timer that starts when i press a button, then i want to pause the timer when i pause the game, after
this, and when the conditions are valid (a ball enters the target), i want to stop the timer, an have-display the time score, and if this time is better than all the previews saved times, to save it and display the new high score (per stage).
I would appreciate any help.
cheers
George

Comments

  • AcceleratedGamesAcceleratedGames Member Posts: 201
    Game Team 1 made a template for that awhile back, if you are willing to pay $10 for it. http://marketplace.gamesalad.com/#category=13&product=4810
  • GyverGyver Member Posts: 37
    Hi George

    I use a separate actor that I call timer and use the actors time function. The time function starts when the actor spawns and ends when it destroys.

    Make a start button and spawn a new actor called timer when you press the start button. If you paus the game the time also stops and when you unpaus the game the time continues.

    When you want to stop the timer and save it make a rule who change an new attribute to the timer actors time and then destroy the time actor.

    For ex.
    IF "target hit" = 0
    then
    change "attribute1" to "timer actors time"

    and destroy timer actor

    I don't know if this helps but feel free to ask again if you need.

    //
    J
  • glyniusglynius Member Posts: 231
    Game Team 1 made a template for that awhile back, if you are willing to pay $10 for it. http://marketplace.gamesalad.com/#category=13&product=4810
    i am willing to pay, but i think that this template is not for time score. thanks anyway
  • glyniusglynius Member Posts: 231
    Hi George

    I use a separate actor that I call timer and use the actors time function. The time function starts when the actor spawns and ends when it destroys.

    Make a start button and spawn a new actor called timer when you press the start button. If you paus the game the time also stops and when you unpaus the game the time continues.

    When you want to stop the timer and save it make a rule who change an new attribute to the timer actors time and then destroy the time actor.

    For ex.
    IF "target hit" = 0
    then
    change "attribute1" to "timer actors time"

    and destroy timer actor

    I don't know if this helps but feel free to ask again if you need.

    //
    J
    cool, sounds logical, i'll give it a try and i will let you know. Thanks!
  • glyniusglynius Member Posts: 231
    Hey Gyver, it works great...the only change is that i don't use a change attribute, i use a constrain attribute because i also want the time to display...
    So, now...to save for each scene the best time, i have to use tables or this could be done by saving behavior?
  • GyverGyver Member Posts: 37
    To save performance you could use the change instead of the constrain. But if it not affect the game then go for it. :)

    To save the time for each level i would do like this.

    Create a table whit as many rows as your game has levels. In the first col you write a high number such as 999 for each row.

    Create a attribute and call it level. Make a rule and increase the level attribute for each new level the player plays.

    When the level is completed and you know what time the player got. Make a rule and check if the players time is better than the time in the table for the row corresponding to the right level. For ex. row one is level one and row two is level two and so on.

    If the time is better then write the new value to the table.

    If you use the level attribute you can use the same rule for all the levels and use the level attribute as the row counter in the table statement.

    //
    J
  • J_PANJ_PAN Member Posts: 140
    @glynius

    try the downloaded template on the Gamesalad popup page, the timer
  • glyniusglynius Member Posts: 231
    Thanks everybody, i did it...
    Tshirtbooth's tutorials are very clear, so following his directions everything worked fine.
    thanks everybody for the assistance.
  • glyniusglynius Member Posts: 231
    edited July 2012
    To save performance you could use the change instead of the constrain. But if it not affect the game then go for it. :)
    J
    I have a display text that shows the time, if i use the "change" attribute instead of "constrain", the time (display text) does not change. I'm doing something wrong?
Sign In or Register to comment.