Misfiring Timer
Posted: Wed Jan 16, 2013 2:47 am
I created a timer that is activated when two actors collide. While the collision and the corresponding timer code work properly, the timer seems to be executing the same code when my actor walks through a small area on the other end of the screen. The region is too far away for there to possibly be a collision and I have confirmed that the collision does not occur (I added a sound to the collision code and it did not play when this issue occurred). It appears that something is causing the timer to fire when the actor walks through this region on the screen. There are no actors and nothing else calls the timer, so I'm not sure why this is occurring. Here are the relevant extracts of the code I have so far.
I'm not sure if it matters but the timer below was originally created with a delay of 250 ms and is being reassigned a new delay value programatically in the following code.
Collision Event Code:
Timer Code:
Animation Finish Event Code:
I'm not sure if it matters but the timer below was originally created with a delay of 250 ms and is being reassigned a new delay value programatically in the following code.
Collision Event Code:
- Code: Select all
if (statsUnit_1[1]<1) // Capping the maximum delay at 1 second
CreateTimer("Waypoint", "Delay Waypoint", statsUnit_1[1]*300);
else
CreateTimer("Waypoint", "Delay Waypoint", 1000);
Timer Code:
- Code: Select all
PlaySound2("data/Event_Accomplished.wav", 0.04, 1, 0);
ChangeAnimation("Waypoint", "Waypoint_Expand", FORWARD);
Speech.animpos+=1;
ChangeTransparency("Btn_Speech_Next", 0);
Animation Finish Event Code:
- Code: Select all
ChangeTransparency("Event Actor", 1);
ChangeAnimation("Event Actor", "Waypoint", FORWARD);
DestroyTimer("Delay Waypoint");