Time for action – Adding a Component to an Actor
For these experiments, we'll go back to our AwesomeGame
classes, specifically our AwesomeActor
.
We'll take a look at how to add and remove Components and how to manipulate them through our functions.
We'll need a blank map for our experiments, so open
AwesomeTestMap
in the editor and delete all of the Kismet,AwesomeEnemySpawners
, the look target, and the weapon spawner. All that should be left is the ground, the player start, and the lights.Save the map and close the editor.
Open
AwesomeActor.uc
in ConTEXT.Components are found under
Object
in the class tree. The one we're most concerned with for this isActorComponents
, which is the one that will be used most when working with UnrealScript. We'll start by adding a SpriteComponent to a new class we'll create,AwesomeComponentActor
. SpriteComponents are most commonly used to give the Actor a physical representation in the editor. First let's create a new file calledAwesomeComponentActor...