Building the Main Scene Behaviors
The first set of behaviors we're going to build are for the Main scene. We want the Main scene Viewport to follow our Main actor, so that the Main actor is always visible.
Using Shortcuts to Build the Main Scene Behaviors
Starting from the scene designer, click on the Behaviors button (see Figure 2-16), which should take you to the Main Scene Behaviors window, as shown in Figure 2-27. From here, expand the Shortcuts drop-down list in the top-right corner, and select the option to "have a viewport following Main 1". This shortcut makes it so that the scene's Viewport(the visible part of the scene) will now follow our Main actor, so if he goes right, the Viewport also will scroll right and we can discover new parts of the scene.
Figure 2-27. Adding a behavior to the Main scene using shortcuts
Building a Property Change Behavior to Reset the Health Property
For our scene, we want to build a property change behavior that will reset the HealthBar property that we defined earlier in the Building Game Properties section. To do this, click the property icon on the left to add a new property behavior (see Figure 2-28).
Figure 2-28. Creating a property change behavior
We want to reset the HealthBar property to 100 when the game loads. Because Popfly Game Creator will, ...
Get Coding4Fun now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.