Time for action – Writing a state
The best place to learn about writing states is in our enemy class. Up until now we've been using TestEnemy.uc
for our enemy code, but now it's time to develop this class more.
Rename
TestEnemy.uc
toAwesomeEnemy.uc
.At the top of the renamed class, change the class declaration line to this:
class AwesomeEnemy extends AwesomeActor;
Notice that we're also removing the
placeable
keyword. Our enemies are handled entirely by theAwesomeEnemySpawner
class now.Speaking of the
spawner
class, we need to change the class reference in our spawn function there. Open upAwesomeEnemySpawner
and change theSpawnEnemy
function and variable declaration to look like the following code snippet:var AwesomeEnemy MySpawnedEnemy; function SpawnEnemy() { if(MySpawnedEnemy == none) MySpawnedEnemy = spawn(class'AwesomeEnemy', self,, Location); }
We'll also need to change the references in our
AwesomePawn
class'sBump
function:event Bump(Actor Other, PrimitiveComponent OtherComp...