Time for action – attaching the Camera Follow behavior
The game file to import and load for this session is 5961_02_11.stencyl
.
Go to the Dashboard tab and click on the Actor Types heading.
Double click on the Stencyl Book Monkey.
Click on the Behaviors button in the row of buttons at the upper-center of the screen.
Click on the + Add Behavior button at the lower-left corner of the screen.
In the Choose a Behavior dialog box, click on the Game option in the left-hand side panel, under the heading FROM YOUR LIBRARY.
Locate the Camera Follow behavior and double-click on it.
Do not change the scroll speed attribute in the behavior configuration screen!
Test the game and try to make the monkey run off the right edge of the screen—run around and see how far the monkey can go!
What just happened?
Attaching the Camera Follow behavior to an actor forces the scene to scroll whenever the actor tries to pass the center of the current screen view. Once our actor reaches either the leftmost or rightmost edge...