Resetting an Attribute Question?

Games4lifeGames4life Member, PRO Posts: 279

Hey GS Community,

I have a question about how to reset an attribute and then add 1 to it.

For example, when the timer hits zero I want the whole scene or at least the attribute to reset. Once reset I want to add 1 second to timer attribute.

When the timer hits zero, reset, add 1 second to the timer.

Pictures would be of no use here because I have no idea even where to start.

Thanks,
~G4L

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited May 2016

    If you are adjusting the timer then you can't* use the built in time attributes (e.g. game.Time). You'll need to use a custom timer, for example:

    Change attribute game.maxTime to 10
    Change attribute game.timeRemaining to game.maxTime
    When game.timeRemaining ≥ 1
         Timer every 1 second
              Change attribute game.timeRemaining to game.timeRemaining-1
    Otherwise
         Change attribute game.maxTime to game.maxTime+1
         Change attribute game.timeRemaining to game.maxTime

    *Well, you can but I find it easier to create my own.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Games4lifeGames4life Member, PRO Posts: 279

    @tatiang said:
    If you are adjusting the timer then you can't* use the built in time attributes (e.g. game.Time). You'll need to use a custom timer, for example:

    Change attribute game.maxTime to 10
    Change attribute game.timeRemaining to game.maxTime
    When game.timeRemaining ≥ 1
         Timer every 1 second
              Change attribute game.timeRemaining to game.timeRemaining-1
    Otherwise
         Change attribute game.maxTime to game.maxTime+1
         Change attribute game.timeRemaining to game.maxTime

    *Well, you can but I find it easier to create my own.

    Thanks very much I'll try this!

  • Games4lifeGames4life Member, PRO Posts: 279

    @tatiang said:
    If you are adjusting the timer then you can't* use the built in time attributes (e.g. game.Time). You'll need to use a custom timer, for example:

    Change attribute game.maxTime to 10
    Change attribute game.timeRemaining to game.maxTime
    When game.timeRemaining ≥ 1
         Timer every 1 second
              Change attribute game.timeRemaining to game.timeRemaining-1
    Otherwise
         Change attribute game.maxTime to game.maxTime+1
         Change attribute game.timeRemaining to game.maxTime

    *Well, you can but I find it easier to create my own.

    I assume this new attribute is an integer?

  • Games4lifeGames4life Member, PRO Posts: 279

    @tatiang said:
    If you are adjusting the timer then you can't* use the built in time attributes (e.g. game.Time). You'll need to use a custom timer, for example:

    Change attribute game.maxTime to 10
    Change attribute game.timeRemaining to game.maxTime
    When game.timeRemaining ≥ 1
         Timer every 1 second
              Change attribute game.timeRemaining to game.timeRemaining-1
    Otherwise
         Change attribute game.maxTime to game.maxTime+1
         Change attribute game.timeRemaining to game.maxTime

    *Well, you can but I find it easier to create my own.

    _Is this how its supposed to look like?
    __

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2016

    @Games4life said:
    _Is this how its supposed to look like?!

    It always helps if people click on the expression box 'e' before taking the screenshot, leaving these windows closed means people cannot check for mistakes in the expressions.

    tatiang's suggestion says . . .

    Otherwise
    Change attribute game.maxTime to game.maxTime+1
    Change attribute game.timeRemaining to game.maxTime

    . . . you've got . . .

    Otherwise
    Change attribute game.timeRemaining to game.maxTime
    Change attribute game.maxTime to game.maxTime+1

    . . . so game.timeRemaining is set to game.maxTime, before game.maxTime has been updated.

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2016

    // double post

  • Games4lifeGames4life Member, PRO Posts: 279

    @Socks said:
    // double post

    @Socks said:
    // double post

    Ah yes I think this works! Thanks!!

  • SocksSocks London, UK.Member Posts: 12,822

    @Games4life said:
    Ah yes I think this works! Thanks!!
    @Games4life said:
    Ah yes I think this works! Thanks!!
    @Games4life said:
    Ah yes I think this works! Thanks!!
    @Games4life said:
    Ah yes I think this works! Thanks!!

    No problem.

Sign In or Register to comment.