Resetting an Attribute Question?
Games4life
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
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
Thanks very much I'll try this!
I assume this new attribute is an integer?
_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.
// double post
Ah yes I think this works! Thanks!!
No problem.