Working with Stencyl
Part 1
At this point you should be able
to control your main character
so that he runs back and forth
and jumps without anything completely
unexpected happening.
Although the background isn't shown here, my level has one. Select and apply a background from either your computer or StencyForge.
Hide/Show Background Button
-Name it rpg_your_name
-640x384 Screen Size
Create a new Scene
-Name: Level1
-300wx12h
-Download a tileset
from StencylForge
-Select it.
-Use anything you
like!
Create a platform
that runs all the way
across the level.
Lay the first tile then
scroll to the other end
of the level and shift-click
the last tile to make straight lines.
Add what you like!
Download an
Actor from
StencylForge.
Assign and configure
the Jump and
Run Movement
Controls.
Select your character and apply the 'Camera Follow' behavior. Once you do this, you should be able to run
all the way across the map. The camera will follow.
Be sure to configure gravity for your
scene!
Let's create a new actor. In this case, it will be a key. We'll search for a door later. You can use either StencyForge or Google Images to add an image.
Google Image Search Tips:
Search Term
It can be any size, and does
not have to be animated. Your
choice!
It's important we choose an
appropriate license.
You should have a key added and
ready to go at this point
The logic found here can be
found under 'Scene.'
This happens when the scene
is created.
Let's add the key to the scene at a
random location each time. We'll start by selecting
the scene and adding the logic seen above.
We are going to add the key at a random 'X' location using the logic found under 'Numbers and Text'
We want to add the key at a random location between zero (The left side of the scene) and
the width of the scene. Run your game and you'll see
that key will appear somewhere different each time.
We are about to use a game attribute to
determine whether our character has run into this key and collected it.
We are going to create a new
game attribute. Call it HasKey1.
It should be a Boolean (true/false)
and its initial value is set to 'No.'
Sometimes we need to use text to check whether the game is working the way we think is should be working. Add a 'Drawing' event and set it up so that it always draws the value of 'HasKey1' at 200,200.
In this way, we can see when it changes.
Eventually, we'll either change this text
or get rid of it.
Select the Key and choose
properties. Click edit groups.
Add a group called key1:
-Make it collide with players,
tiles at least.
-Add the key to the key1 group.
Here is the collision info for the player.
Make sure it collides with key1 and tiles
and is assigned to the players group.
We want the key to disappear when we run into it. With the key selected, create a collision event 'Group&Group.' When you test the game with this logic, the key should vanish when you run into it.
Be sure the events are set up
in the right order on this list.
Now, with the level selected, we're going to modify the value of the 'HasKey1' attribute.
Create a 'Group&Group' collision event and
set the value of 'HasKey1' to true when this
event is triggered as seen above.
At this point, you should be able
to test the game. When you run into the
key, the debug text should change from
'false' to 'true.'
Now we are going to create a doorway
to level 2. However, we must first create a
second level. Go ahead and set up a Level 2
with some basic elements as seen above.
Now we going to add a door. Create an actor
and drop it at the end of level 1. --Simple
Now, we need to create a door region.
After double clicking
the region, you can rename
it here
Select the draw
region tool and
draw a box around
your door
The trick here is to make it so
that your player only moves
to level 2 in the event he has
obtained the key.
With Level1 selected, create a
Specific Actor enters region event
and configure it with the logic
seen to the left.
(If HasKey1= true, switch level.)
Required Challenge:
On Level 1
-Create a second key that is a different color.
-Create a second door
-Create a 'Treasure Room' Level
-The second door will then lead to the treasure
room.
-The treasure room should contain a doorway
that leads back to level 1.
-The treasure room should contain a series
of gold coins, diamonds, or something similar
that we will collect for points. However, the point
collection does not have to work right now.
We'll set that up in part 2.