spawning an actor with a timer
chrsmys
Member Posts: 23
I have a timer that runs every 5 seconds and when that timer goes off it is supposed to spawn an actor the only problem is it spawns a lot of actors i only want it to spawn one.. am i using this wrong?
Comments
Also, is the actor that is going the spawning, is it in the scene only once or multiple times?
Sounds like you may have an enemy spawning more of itself and the spawns just compound over time (or something similar)!?
Usually, you will create a "scene controller" actor or an "enemy spawner" actor or such that controls certain events in the scene, such as spawning enemies appropriately, respawning the player after death, initialzing the scene's game attributes, background music, handling scene transistions, etc.
Phrew...that is a whole lot of spawn goin' on.
thanks for the help
You can always manuall place them on the edge of the scene and move them in and out as needed.
Also keep the rules that are in the actor you are spawning to a minimum. For example, if you have a guy that has a movement rule & then a 'lives' rule. You'll be fine. But if you have a lot of rules like my guys do EVERY spawn will cause the game to hiccup. VERY noticeable.
What I did on mine was spawn the monsters off screen. ALL at the same time, so there would only be 1 small hiccup. I covered that up by placing a timer at the top of the screen that says "Wave Starts in 3...2...1..." (counts down). So when they actually spawn nothing really is happening on screen, so it SEEMS like it goes off without a hitch.
I also have it so that when the countdown reaches 0 it makes changes a game.attribute which indicates for the monsters to start moving. So the monster don't move until I tell them to. This way it still looks as if all the monsters a being spawned one after another, yet they aren't. This is just one little trick that had a MAJOR performance boost for me.
Again if each actor only has a few rules you will be fine spawning them. I spawn my spells, b/c all they really have in them is a movement rule. Hope this helped.