19,963
Views
Beginner
Level
3
Comments
Chapter 4 Challenge - The Solution
by Jon (Updated on 2015-10-26)
This is the solution to Chapter 4’s Challenge, where we walk you through each step.
Return to the Chapter 4 Challenge
Download the Solution
To install the project, import it from the File menu (File > Import Game…). Requires Stencyl 3.4.0 or later.
Contents
- Part 1: Creating Your Scenes
- Part 2: Adding Background Music
- Part 3: Making the Switch Scene Behavior
- Part 4: Making the Enemies Destroyed Behavior
- Part 5: Making the Door Trigger Behavior
- Part 6: Making the Switch and Open Door Behaviors
- Part 7: Bringing it All Together
Part 1: Creating Your Scenes
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.
Part 2: Adding Background Music
Just add this Behavior to the first Scene. Music to Play is an Sound attribute.
Part 3: Making the Switch Scene Behavior
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.
Part 4: Making the 'Enemies Destroyed' Behavior
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.
Part 5: Making the Door Trigger Behavior
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.
Part 6: Making the Switch and Open Door Behaviors
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.
Part 7: Bringing it All Together
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.
On to Chapter 5
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.
Print Article Edit Article How to Edit an Article3 Comments
Tip: The Player walks throught tiles so you have to set it's actor group to collide with tiles.
0
Activating a tall same twice, the door opens. To get you have to activate the two, you can include a condition that the animation comprueve is off before increasing "Switch counter".
-1
not a completely direct solution especially for apprentices like myself. Can u make the FULL solution
3