by Jon (Updated on 2015-10-26)
This is the solution to Chapter 4’s Challenge, where we walk you through each step.
To install the project, import it from the File menu (File > Import Game…). Requires Stencyl 3.4.0 or later.
You’ll need at least 5 Scenes (though you can make more if you want).
Create each of your Scenes but leave space in each for a “door” Actor that the player’s Hero will have to open.
Add enemies to each Scene as you see fit.
Just add this Behavior to the first Scene. Music to Play is an Sound attribute.
1) A Region acts as the trigger for this Behavior in each Scene. Note this is a one-way Scene transition - the player can’t go back to a previous Scene.
2) In this case, our “door” Actor looks just like the walls, to make each one look like a “secret exit.” If you mouse over it, the Scene Designer will highlight it.
Tip: To perfectly position an Actor so it aligns with the grid of tiles, hold down the Shift key.
Starting with this Behavior, each one from here on out will act as a different way for the player to progress from Scene to Scene.
1) This is a Scene Behavior. It uses a simple technique to find out how many enemies are in a Scene and then sets that value as the number of enemies the player’s Hero must destroy to progress.
2) This Behavior uses 3 types of Events, When Created, Actor Created/Dies, and Attribute.
This is another simple Behavior. It’s attached to the Actor Type we’re using as a switch. The Hero only has to step on it to open the door.
This Behavior is attached to two switch Actors. The player has to maneuver the Hero onto each switch and press a key
1) This Behavior is attached to an Actor that’s a sensor, which allows our Hero to walk on it.
2) It works with another Behavior called Open Door, shown below.
3) We used a Game Attribute to keep track of the total number of switches the player’s Hero has activated. Don’t forget to set the value for Switch Counter to the actual number of switches in your Scene!
4) Open Door is attached to the door actor.
1) Your final Scene needs a Behavior that draws text on screen. Make sure you can easily swap out the font.
2) Only place your Hero Actor in the first Scene.
If you want a little more of a challenge, add a title screen and after the player reaches the final room, switch back to the title screen.
Now that you’ve learned more about Scenes and how they work, let’s move on to Chapter 5 and delve deeper into the features you'll need to create a complete game.