IF statement isn't working
Posted: Mon Jan 02, 2006 6:39 am
Hi!
I just registered to the forums because I have a problem and the help file couldn't answer it. In my game, all the levels have a time limit. The time limit is the value of the actor "time". This value is decreased by one every second.
When the time limit reaches 0 (time.textNumber = 0), I need the player to die and a gameover text to appear. I also want the timer to dissapear. To do so, I have attached this script as a Timer event to the actor "time":
But the event doesn't work - it just ignores the if() statement entirely and instead just sets the value of "time" to 0! Why is this?
I just registered to the forums because I have a problem and the help file couldn't answer it. In my game, all the levels have a time limit. The time limit is the value of the actor "time". This value is decreased by one every second.
When the time limit reaches 0 (time.textNumber = 0), I need the player to die and a gameover text to appear. I also want the timer to dissapear. To do so, I have attached this script as a Timer event to the actor "time":
- Code: Select all
time.textNumber = time.textNumber - 1;
if(time.textNumber = 0)
{
DestroyTimer("time");
DestroyActor("player");
CreateActor("gameover", "icon", "no parent", "no path", 0, 0, true);
DestroyActor("time");
}
But the event doesn't work - it just ignores the if() statement entirely and instead just sets the value of "time" to 0! Why is this?