How to make an attribute change every 24 hours

carlblanchetcarlblanchet Member Posts: 755
edited August 2012 in Working with GS (Mac)
Hey all!

Just checking if this is even possible, but I would like to implement in my game a collect coins button that destroys itself when collected and spawns back 24 hours later.

The first way for making this that came to my mind would be to have the collectButton actor: when pressed, destroy actor, change attribute Collected to true. Then have a spawner actor: when attribute Collected is true, after 86,400 seconds (lol) change attribute Collected to false / when attribute Collected is false, spawn collectButton actor.

The thing about this is that the timer probably doesn't countdown when the app is closed... or does it?

Do you know any other way of accomplishing this?

Thanks a lot! :)

Comments

  • carlblanchetcarlblanchet Member Posts: 755
    @uptimistik Awesome, now I know it's doable :P. I'll play around with it and hopefully I'll be able to figure something out. Thanks man!! :D
  • carlblanchetcarlblanchet Member Posts: 755
    I'm having some difficulty getting this to work..

    So I created a self index attribute that I called 'Day', and a boolean attribute that I called 'DailyButtonPressed'. Then added the rules:

    (Both attributes are loaded)

    ~If attribute DailyButtonPressed is True~
    -Destroy-

    ~WHEN TOUCH IS PRESSED~
    -Change self.Day to game.clock.day-
    -Change DailyButtonPressed to True-
    -Destroy-

    ~WHEN TOUCH IS RELEASED~
    -Save attribute DailyButtonPressed-
    -Save attribute self.Day-

    ~If attribute self.Day is not equal to game.clock.day~
    -Change DailyButtonPressed to false-

    With all this implemented, every time I leave the scene and come back, the button reappears. Can anyone see why this isn't working?

    Thanks!
  • carlblanchetcarlblanchet Member Posts: 755
    ^^bumpidibumpidoo ^^ :)
Sign In or Register to comment.