The game file that needs to be imported and loaded for this session is 5961_04_05.stencyl
.
We're going to start by creating a behavior to drop the statues into a single location in the scene, and then we'll refine the behavior as we progress. Execute the following steps in order to create a behavior to drop the statue:
Drop Actors Randomly
and click on the Create button to display the behavior editor.Drop statues
.3
into the white textbox.320
into the white textbox to the right of x:.10
into the white textbox to the right of y:, as shown in the following screenshot:We've created a new scene behavior that drops the statue actor into the jungle scene every 3
seconds. Rather than being attached to an actor, this behavior is attached to the scene, because the scene is going to create the statues for us.
We needed to tell the create Actor Type at …
block which actor to create, and where to create it, so we selected the statue actor type in the Choose Actor Type dialog box. The numbers that we entered in the x: and y: textboxes represent the location on the screen where the statue will be created. Although we have some work to do to position the statue correctly, the numbers we provided are adequate for testing if the behavior is carrying out its main task correctly.
When we test the game, we can see that a new statue actor appears at the top-center of the screen every three seconds. However, we can quickly determine that things are not quite right. If we move the monkey, we can see that the statue is always dropping into the scene at exactly the same position, which is probably not what we're hoping for, because it won't present much of a challenge for players of our game when the monkey progresses to the other end of the scene.
We've already identified one unexpected issue—the statues always fall in the same location—but it's now time to give the game a really good testing and make a note about what happens when, for example, many statues are allowed to fall into the scene. Try it.
There may be other problems to be found, but it's important to understand that these bugs aren't necessarily faults with Stencyl, they may be system limitations (that is, known features) or they could be caused by the way that we have designed the game—for example, the player's character may become stuck at a certain point in a scene if we haven't carefully considered the placing of tiles.
Sometimes these effects are desirable in a game but, if they are not, we will need to change our game so that it works differently, so it's a good idea to note any problems as early as possible (always keep a notepad and pencil at hand). It's all part of the learning process.
We'll fine-tune the behavior that drops the statues as we progress through this chapter but, before we can do that, we need to understand a little more about the relationship between screen and scene sizes.
18.219.63.90