Learning Stencyl 3.x Game Development Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Time for action – adding an actor to the jungle scene

The game file to import and load for this session is 5961_02_03.stencyl.

We need to ensure that the Animation Editor is displaying the monkey animation so, click on the Actor Types heading in the Dashboard, then double-click the Stencyl Book Monkey thumbnail in the main panel.

  1. Click on the green Add to Scene button at the upper-right corner of the screen.
  2. Click on the green Jungle scene that is shown in the Choose a Scene dialog box.
  3. Click on the OK button to display the scene.
  4. Move the mouse cursor (which shows the monkey) into the center of the green jungle scene.
  5. Click on the mouse once to place the monkey into the scene.
  6. Press Escape on the keyboard.
  7. Click File | Save Game to save the game (or click the Save Game icon on the toolbar).

What just happened?

We have placed the monkey actor into the jungle scene, which was as easy as selecting the scene and then clicking on the mouse where we wanted the actor to appear. We only have one scene in our game, so it wasn't a difficult choice to make!

We are currently looking at the Scene Designer, which shows the design of the scene, and, to the right of the scene view, we can see the Actors in the Palette tab.

Currently, we can only see one actor in the palette—the monkey—because this is the only actor in our game. As we add more actors, they will be added to the Actors palette, and then we can click on any actor and add it to the scene as required.

If we wanted to place several copies of the actor into the scene, then we could have done so by moving the mouse and clicking on it each time we wanted to add a copy of the actor. It's not strictly necessary, but pressing Escape cleared the monkey actor from the mouse cursor so we didn't accidentally place more than one copy of the actor into the scene.

If we accidentally add more than one monkey to the jungle scene, it is easy to remove the unwanted actors—ensuring that the Escape key has been pressed, click on the unwanted actor and press the Delete key to remove it.