Time does not set to 0 when it should

my game is based on a series of spawnings of enemies, every 30 seconds the enemies get tougher.
Now I was testing my game on my iphone and when I restarted the game, the same (equally tough) enemies spawned in the beginning as at the end of the previous game. I checked the code and every way to restart had a rule that said: when touch is pressed, set game.time to 0.
This apparently didn't work. Does anyone know how to solve this?

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    You can't set game.time to 0.
  • vincentWvincentW Member Posts: 47
    how do I make it work then?
  • vincentWvincentW Member Posts: 47
  • SocksSocks London, UK.Member Posts: 12,822
    edited September 2013
    ...
  • -Timo--Timo- Member Posts: 2,313
    You can set game.time to 0 when it's a self made attribute. Make a text and displaye text game.time if it doesnt change to 0 then there is something wrong with your rule and if it does change then the problem is somewhere else :)
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited September 2013
    The actor that currently increases the toughness every 30 seconds, have that spawn on to your scene each time a level or game has started, and then use the actors self.time, not the game.time.

    An actors self.time starts at 0 when it first spawns.
  • natzuurnatzuur Member Posts: 304
    Just to elaborate a bit more on the time attributes:

    self.time is the up time of an actor, so it starts counting on the spawn of the actor its being used in.

    game.time is the up time of the game and starts counting at the time the game is opened up, and continues as long as the game is open.

    you also have the device year, month, day, hour, minute, second, and millisecond. These are are pretty straight forward, they are referenced straight from the device.

    None of these are changeable within the run time by you, but they can be referenced to be used in equations and behaviors and are very powerful in this capacity.
  • vincentWvincentW Member Posts: 47
    Thanks, I solved it by using self.time!
  • -Timo--Timo- Member Posts: 2,313
    edited September 2013
Sign In or Register to comment.