-
Book Overview & Buying
-
Table Of Contents
Unreal Development Kit Game Programming with UnrealScript: Beginner's Guide
By :
Let's say instead of spawning enemies straight away when the game started, we wanted them to spawn after say, 10 seconds. That should give us enough time to start running.
Let's create a new function in AwesomeEnemySpawner called TimedEnemySpawn
. We'll create the timer here:
function TimedEnemySpawn()
{
SetTimer(10, false, 'SpawnEnemy');
}The parameters for the SetTimer function are pretty easy. The first one is the amount of time for the timer. The second is an optional bool that controls whether or not we want the timer to run in a loop, in this case it would run every 10 seconds if we set it to true. The third parameter is the name of the function we want the timer to call when the time runs out. In this case, it will call the function that actually spawns the enemy.
With this new functionality, we're going to need to keep a closer eye on the enemies we're spawning. If the spawner has already spawned an enemy, we don't want it to spawn another...
Change the font size
Change margin width
Change background colour