Actors are the characters and objects in your scene that you can interact with.
Adding an Actor
To add an actor to a scene click the + button in the Editor Tools and select Actor from the menu (alternatively press the A key), then click on the scene and position where you wish to place the actor.
- Name - Names your actor. Giving your actors a name helps organize them in your project. An actor's name will be visible in any drop-down menu that asks you to pick an actor, such as the Actor: Hide event.
- Position - Sets the X and Y position where the actor will be positioned in a scene. You can also change this by dragging the actor around the the Game World.
- Pin to Screen - Using the Pin Button next to the actor position you can choose to pin the actor to the screen which cause it to not move as the game screen scrolls.
- Sprite Sheet - Choose which sprite graphics should be used to display the actor.
- Movement Speed - Choose how fast the actor should move when scripting events are used.
- Animation Speed - Choose how fast the actor animations should play.
- Collision Group - Choose if scripts should play automatically when colliding with this actor.
Pin to Screen
When an actor is pinned, the actor will not move without a script, and does not create collisions with other actors in your scene.
Enabling this property will temporarily change your scene to be blacked-out, with a
160px x 144px boundary in the top-left corner showing part of your original scene. Use your mouse to drag the actor to where you want it to be pinned to the screen.
Select a different actor, the scene, or the project to return the blacked-out view of your scene to normal.
Actors can be given a collision group in the Editor Sidebar. When enabled, the option to run scripts based on collisions will appear in the Editor Sidebar. To learn more about On Hit scripts, see the documentation for Scripting.
Actors can contain multiple scripts that will be called a different points in your game.
- On Interact: This is called if the player stands in front of this actor and presses the Interact button.
- On Hit: (only if collision group is set) This is called when this actor collides with either the player or a projectile with a specified collision group
- On Init: Called as soon as the scene is loaded in game.
- On Update: Repeatedly called while the actor is on screen, and once the script finishes it will repeat. You can use this to create movement scripts
To start building a script, select an actor, click the script type you want to edit and click the Add Event button in the Editor Sidebar to open the event menu. Select an event to add it to the script.
For more information see the documentation for Scripting.
There are limits to how actors and their sprites can be used in GB Studio. These limits are to make sure your game appears as intended, as well as to keep your actor logic running smoothly. The exact limits depend on the complexity of the background image used in your scene, see Scenes for more information.