6. Actors in GameSalad
Actors represent the visible objects within your game. Actors can represent the character that the player is controlling or they can be the surrounding objects/characters that your player talks to, collides with, jumps over, or generally interacts with during gameplay.
Game designers often begin their process in Creator by creating the set of actors that they will need in their game across different scenes. These are known as “prototypes” (or models) of the actual actors/characters instances that your players will interact with within your scenes. For example, in Pacman, you would create a ‘ghost’ prototype, specifying some visual attributes of the ghosts, and how the ghosts would behave in the game. Each ghost that actually appears in each scene/level of the game is a specific instance based on this ghost prototype (and would therefore inherit all the attributes and behaviors of the prototype). If you make a change to the ghost prototype, all ghosts within the game would also be changed.
Actors instances are the building blocks of a scene. To create an actor instance, simply drag an actor prototype into a scene. Any changes you now make to this specific actor within the scene will only affect that actor instance, not the prototype itself.
The following attributes define each actor:
- stretch: the image will be stretched or compressed to fit within the boundaries of the actor.
- fixed: the actor will show its image at the size/resolution of the file. The image will be centered to the actor and the actor can be made smaller or bigger than the image resolution without changing the look of the image.
- tile: the image will be repeated if the actor is larger than the image resolution.
Physics-related attributes (non-motion physics)
New actor attributes may be created and removed using the (+) and (-) buttons on the bottom left of the attributes pane. The newly created attribute will appear highlighted near the bottom of the attributes list. These attributes can accessed from the rules editor, and be changed via the Save Attribute behavior unless otherwise noted.
As mentioned earlier, modifying an actor prototype affects all corresponding instances of this actor. You can customize specific actor instances as you like by double-clicking an actor instance. If you select an actor instance, the rules editor will initially be locked so that you do not accidentally modify the logic of your actor instance to differ from its prototype. However, you can simply click on the lock icon to unlock the space and allow editing. You can revert to the prototype’s rules by pressing the Revert to Prototype button at the top of the rules editor. You can modify the attributes of an actor instance without needing to unlock the attributes pane. You can revert individual attributes by selecting an attribute and pressing the Revert to Prototype button at the top of the attributes pane.
Actors can be added to your scene in a couple of different ways. First, you can have your actors start in the scene. To do this, simply load up the desired scene in the scene editor and drag your actor to where you want it. Second, you could have your actor start "off-scene", but enter the scene at some point during gameplay. You'll notice that if your scene size (located in the scene editor; select the "scene" toggle, and then the "attributes" tab) is larger than the camera size (dictated by the platform you've chosen), there will be areas of your scene editor that are outside the scope of the camera. You can place actors here and have them move into the scene using a variety of movement behaviors, which are discussed in a later tutorial. Finally, you can "spawn" actors using the Spawn Actor behavior. This will place the actor at a designated location and velocity in your scene.
Wrap-up Questions for Actors in GameSalad