I have a top-down shooter where enemies are spawned based on time. I've created a timer that counts time since the start of the layout - since game time isn't reliable after you've died or moved levels, etc.
The problem I'm getting is I tell the system to spawn an enemy when the timer = 20. If I set the timer to tick up every one second, then it will spawn like 50 enemies because of the length of time that the scenario is true. If I set the timer to count up by tenths or hundredths of a second, then the system won't even register 20.00 seconds and nothing will spawn. I've messed around with half seconds, quarter seconds, etc. and there doesn't seem to be a sweet spot. I either get a stream of enemies or no spawn.
The odd thing is that if I use game time then it's flawless. I say spawn at 20 seconds and it only spawns one sprite. Also, game time doesn't sync up with any of the timers I've made, it will hit 10 seconds when my timer is at like 6.5, even though they're both counting up in seconds. I feel like I have to be doing something stupid. Please help!