My Timer is skipping a beat?
ShaneS429
Member Posts: 77
I currently have a game that spawns 2 sets of "enemies."
Both sets of enemies spawn every 2 seconds but Set B spawns in between Set A, making an enemy spawn every second.
Right now my code is something like this.
Set A:
Every 2 Seconds
Randomize Enemy (1-7)
Spawn that Enemy (1-7)
Set B:
After 1 Second
Every 2 Seconds
Randomize Enemy (1-7)
Spawn that Enemy (1-7)
The goal is to get it to alternate Set A and Set B every other second thus the After 1 second for Set B.
The problem I am having is the enemies aren't being spawned every 2 seconds. I've placed a few actors on the scene to display the game time and the generated random numbers.
Sometimes at 9 seconds a Set B enemy wont appear, sometimes at 31, 21, 17. Sometimes it happens when the random number is 1, sometimes 3, etc. There is no pattern to help me figure out why my timer sometimes seems to skip a step and just not randomize and spawn an enemy.
I've checked the Run to Completion boxes on every timer in every possible configuration of them being on/off and nothing fixes it. Any ideas?
Edit: I should also add I don't mean I am doing a Spawn Actor behavior. I simply mean I am taking an enemy and moving them across the screen when they are called to recycle them.
Both sets of enemies spawn every 2 seconds but Set B spawns in between Set A, making an enemy spawn every second.
Right now my code is something like this.
Set A:
Every 2 Seconds
Randomize Enemy (1-7)
Spawn that Enemy (1-7)
Set B:
After 1 Second
Every 2 Seconds
Randomize Enemy (1-7)
Spawn that Enemy (1-7)
The goal is to get it to alternate Set A and Set B every other second thus the After 1 second for Set B.
The problem I am having is the enemies aren't being spawned every 2 seconds. I've placed a few actors on the scene to display the game time and the generated random numbers.
Sometimes at 9 seconds a Set B enemy wont appear, sometimes at 31, 21, 17. Sometimes it happens when the random number is 1, sometimes 3, etc. There is no pattern to help me figure out why my timer sometimes seems to skip a step and just not randomize and spawn an enemy.
I've checked the Run to Completion boxes on every timer in every possible configuration of them being on/off and nothing fixes it. Any ideas?
Edit: I should also add I don't mean I am doing a Spawn Actor behavior. I simply mean I am taking an enemy and moving them across the screen when they are called to recycle them.