Академический Документы
Профессиональный Документы
Культура Документы
0, 18/01/2016
Platformer Template
Ryan Brown
Page 1 of 21
V1.0, 18/01/2016
Contents
Introduction Page 3
Adding Levels Page 7
Player Character Page 11
Enemies Page 13
Coins Page 17
Common Problems Page 19
Document History Page 20
Credits Page 21
Page 2 of 21
V1.0, 18/01/2016
Introduction
Welcome to my Platformer Template! I hope you enjoy using it and have fun creating a game.
Firstly I want to introduce you to the software we are going to be using. It is called Construct 2 and is
made by a company called Scirra. There is a free version available from their website and my
Platformer Template only uses functions in the free version so its really all you need to get started.
However, you can unlock more features by paying for the Personal Licence which currently costs
79.99. Construct 2 allows you to make games that you can play on your computer, tablet,
smartphone or pretty much any device which has a modern web browser, but with the free version
we are limited to only making HTML5 games.
Making computer games is hard work and traditionally you spent hours typing out hundreds of lines
of code that look like this:
And if you made one little mistake on any one of those hundreds of lines, your game would probably
not work!
Fortunately, in Construct 2 you will not have to type in any code. Just pay attention and you will be
fine.
If you dont have it already, grab a copy of Construct 2 from the website:
https://www.scirra.com/construct2
Page 3 of 21
V1.0, 18/01/2016
Features
Keyboard controls
Touch-screen controls for mobile/tablet devices
Choice of five player characters
Eight different enemy characters
Destructible enemies
Indestructible enemies
Score, lives and timer
Collectible coins
Checkpoints (not yet documented)
Level decorations (not yet documented)
Music and sound effects
To Do
Here is a (likely incomplete) list of things that I intend to add to Platformer Template and this
documentation:
Q&A
Im sure you have lots of questions about what were going to be doing, so hopefully this next
section will answer some of those for you!
Page 4 of 21
V1.0, 18/01/2016
The Platformer Template is designed to allow you to create your own platform game, without
stressing about all the nuts and bolts behind the scenes and just concentrating on creating fun to
play levels.
I was really hoping with Platformer Template to create something close to Mario Maker. I appreciate
that the end result is still a long way off this stellar Nintendo game, but hopefully the goal of
enabling users to create their own Platform Games without worrying about all the complicated code
has been realised.
If you are using the free version of the Construct 2 software it allows you to export our game as a
HTML5 web app that can be uploaded to a website for other people to play on lots of different
devices, but you will need to connect to the internet to play your game.
If you enjoy using Construct 2 and want to purchase the full version (currently 79.99) then you will
be able to create standalone (i.e. non-website) versions of your game that can run on Windows, Mac
OS, Linux, iOS and Android.
Construct 2 has a simplified drag and drop interface that makes it really quick to put a game
together. This means no typing in long lines of complicated syntax, which can be very difficult. Fixing
bugs from typing mistakes can be hugely time consuming and can mean you dont get very much
done. This slow pace leads to frustration and invariably thats where people give up on their dreams
of creating their own game.
But even with Construct 2s simple (and excellent) Events system, it can still be easy to make
mistakes if you dont know how things work. So with Platformer Template all the events already in
place, so all you have to do is worry about creating your levels!
What if I want to look at the code, sorry events that my game uses?
You are more than welcome to do so and I really hope that you learn something from it! If you want
to explore Construct 2 further then Scirra (the publishers of Construct 2) have a free e-book on their
website with some example projects that you can follow to learn more about Construct 2 and the
event system.
Where did the graphics, sounds and music in the Platformer Template come from?
Page 5 of 21
V1.0, 18/01/2016
Almost all of the graphics in the Platformer Template are freely available from the website of
Kenney: http://www.kenney.nl/
There are lots of other free art packs available on his site for a wide variety of games including RPGs,
shoot em ups and puzzle games. I highly recommend checking them out. You might also want to
take a look at his page on itch.io where you can purchase other tools and assets to support his work:
http://kenney.itch.io/
Anything not by Kenney (i.e. the text and logos) were created using the Cooltext website:
http://cooltext.com/
Some sound effects were from Kenneys website while others were created using Bfxr:
http://www.bfxr.net/
Music on the title screen was taken from The Open Bundle: http://open.commonly.cc/
All the material in the Platformer Template has been made available by the creators using a Creating
Commons CC0 1.0 (Public Domain) license, which means we are free to do whatever we want with it.
The person who associated a work with this deed has dedicated the work to the public domain by
waiving all of his or her rights to the work worldwide under copyright law, including all related and
neighboring rights, to the extent allowed by law.
You can copy, modify, distribute and perform the work, even for commercial purposes, all without
asking permission. See Other Information below.
Other Information
In no way are the patent or trademark rights of any person affected by CC0, nor are the rights that
other persons may have in the work or in how the work is used, such as publicity or privacy rights.
Unless expressly stated otherwise, the person who associated a work with this deed makes no
warranties about the work, and disclaims liability for all uses of the work, to the fullest extent
permitted by applicable law.
When using or citing the work, you should not imply endorsement by the author or the affirmer.
Page 6 of 21
V1.0, 18/01/2016
Adding Levels
The Platformer Template starts with one example level. You are almost certainly going to want to
add your own levels and probably replace this sample level altogether, so here you will find out how
to do this.
Go to the Projects pane in Construct 2 and you will see a series of folders. The first of these is called
Layouts. You can think of Layouts as being levels in your game, you will want to have a new Layout
for each level. Inside the Layouts folder you will find a Layout called Template. This is the
foundation for creating all your levels. I have included second copy of this called Template-Backup
should you ever accidentally lose or delete the original Template Layout.
Right click on Template and in the menu that pops up you will see an option to Duplicate. Click on
this and Construct 2 will create a copy of the Layout and will prompt you for a name, defaulting to
something like Layout1.
Platformer Template expects all our levels to be called Level1, Level2, Level3, etc. The code
that controls our game and determines which level needs to be loaded next relies on this, so if you
do not name your levels correctly they will not work.
For now call your level Level2. Then double-click on it to open the Layout in the main editor
window of Construct 2.
You will probably find that the view of your new level is quite zoomed in, so lets sort that out.
Page 7 of 21
V1.0, 18/01/2016
Next, click on the Zoom out button. You should only need to click on it once (depending on the size
of your screen), but if you zoom too far out then you can always use the Zoom in button above it
to zoom back in.
Now we want to turn on a couple of options which arent enabled by default; Snap to grid and
Show grid. With these options turned on when we are positioning things in our level they will
automatically slot into place according to gridlines. That makes it much easier to organise things in
our level.
Finally, we need to increase the size of our grid, which defaults to 32x32. To do this click in the box
next to Grid width and change it from 32 to 64 and press Return. Then do the same for the box
next to Grid height.
If you look at your new level now, you will find that all you have is a long flat piece of ground that
goes from one end of the level to the other, with an exit sign at the end. Thats not very interesting,
so lets add some features!
Our levels are created using something called a Tilemap. This makes it much more efficient when the
game is running, so our game can work easily on traditionally lower-powered devices like
smartphones just as well as it will on the latest desktop PC.
Go to the Objects panel at the bottom right part of the screen and scroll to the bottom. Click on the
Tilemap object. Now click on the Tilemap tab below that and you will see in the small window all
the possible tiles you can use when creating your level. (Note: use the scroll bars at the side and
bottom of the window to see more!
Page 8 of 21
V1.0, 18/01/2016
Next time we will cover adding cool decorations, coins, enemies and other things to our levels, but
for now just work on creating a level that you like. You can test your level at any time by clicking on
the Run Layout button.
By default, if we use the Run Layout button in Construct 2 it will automatically load and run the
Layout (level) we are currently working on. But when it comes to creating our final game, or testing
that we can move from level to level or from the main menu to a level, we need to set some things
up.
Now, as mentioned in the basic tutorial, all our levels must be called something like Level1,
Level2, Level3, etc. Make sure your new level is named appropriately.
If you want to get rid of the original Level1 then feel free to delete it by right-clicking it in the
Projects panel (under Layouts) and selecting Delete. However, it might a better idea, for now, to just
rename it so we can always refer back to it later. To do that, right click and select Rename and use a
new name like Old1. You can then rename your level to be the new Level1.
Alternatively, name your level to fit in with the existing levels, e.g. Level2 or Level3 or Level99,
whatever. Just make sure there are no gaps between the level numbers or the game wont work
properly.
If youve just replaced Level 1 then you dont need to worry about anything else. Run your game by
using Run Layout from either the Level1, or Title layouts and it should all work correctly.
Page 9 of 21
V1.0, 18/01/2016
Click on the Game Events tab to look at all the Events that control the logic for our game. Feel free to
look through these if you are curious, but be careful not to change anything as you will likely break
the game!
Right at the top of our Game Events tab are a number of Global Variables that control how things
work in the game. These are things you can tweak and change some of these if you want to.
Changing these WILL affect your game, but importantly it shouldnt break the game.
PlayerCharacter (1 to 5) this affects what the player character looks like, refer to the Player
document for more details on this.
LevelTime (default is 99) this affects how much time the player has to complete the level. If the
time runs out it is game over. Increase this if you think it is too hard, decrease it to make it harder.
Note that this affects ALL levels.
Lives (default is 3) this is the number of lives your player character starts the game with.
EnemySpeed (default is 1.5) this is the speed of the enemy characters, increase this to make them
move faster, decrease to make them move slower.
The final variable we can alter is LastLevel. This determines how many levels are in our game.
Originally this is set to 1 as we only have 1 level. However, if we want to add a Level 2, Level 3, etc.
then we need to set this to the number of the highest level.
So for example, if our game has 5 levels then LastLevel would need to be set to 5. If youve just
added a Level 2 then set this to 2. If you then open the Title layout and select Run Layout you
should be able to start the game on the title screen and then play through level 1 and level 2 before
getting to the end of game screen.
And thats it, your new level has been added to the game! Now, go create another one!
Page 10 of 21
V1.0, 18/01/2016
Player Character
Because life would be boring if we all looked the same, I thought it would be nice if games created
with Platformer Template could have some variety by allowing us to have different characters in
them.
PlayerCharacter
To select the character you want to appear in your game, you will need to change a variable in the
Game Events tab.
Game Events is where all the logic that controls the game sits. This is the Construct 2 equivalent to
coding but a lot less complicated. It can still be a bit tricky to understand though, so I dont
recommend you change anything as you might not like the results. Feel free to look through it
sometime though and if you do want to experiment, make a backup of your game first!
Page 11 of 21
V1.0, 18/01/2016
Anyway, right at the top of the Game Events page you will see a series of variables that control how
things work in our game. We are looking for the one called PlayerCharacter. If you double-click on
this, it will open a small dialog box like this:
Where it says Initial value you can type in a number from 1 to 5, matching the character from the
table on the previous page that you want to use.
Note that if you try any other number you will probably break your game, so dont do it!
Page 12 of 21
V1.0, 18/01/2016
Enemies
Platformer Template has several enemies included which are divided into two categories,
destructible and indestructible.
Destructible enemies are, as the name suggests, ones that we can destroy (by jumping on top of
them) to earn points. Here are the enemies in this category:
EnemyDestructible object
Wasp
Mouse
Slime
Fly
Worm
Page 13 of 21
V1.0, 18/01/2016
The game is set up so that enemies will automatically move around, but we need to put other
objects in place to keep them under control!
Position the goLeft and goRight either side of your destructible enemy. You can put them as close or
as far apart as you wish. All destructible enemies start off facing (and moving) to the left. When your
enemy collides with the goRight object, they will turn around and start moving to the right. Likewise
when they hit the goLeft object, they will turn around and move to the left.
Page 14 of 21
V1.0, 18/01/2016
Unlike our destructible enemies, indestructible enemies cannot be destroyed. Touching them
anywhere will cost the player a life. Here are the enemies in this category:
EnemyIndestructible object
Saw
HalfSaw
Barnacle
Adding a EnemyIndestructible object to your game is much the same as the EnemyDestructible.
Again you need to drag the object into your level and then change Initial Animation to match one of
the objects listed above, e.g. Saw. The only difference is you need to set the initial direction you
want the enemy to move in.
To do this, add an EnemyIdestructible by dragging it into your level from the Objects panel. Now
make sure it is still selected and look at the Properties panel. You are looking for the Instance
variables section and the variable called moveDirection:
In the box next to moveDirection, type 0 (right), 90 (down), 180 (left) or 270 (up). If you try and use
any other values it will not work properly!
If you are wondering how fast your enemies will move, this is controlled by a variable that is stored
in Game Events. If you want to look at it, click on the tab and you will find all the variables at the
top of the events list.
EnemySpeed controls their speed and the default setting is 1.5. You can increase this to make them
move faster, or decrease it to make it move slower. Bear in mind though that this settings is applied
to ALL enemies in the game. At the moment there is no way to change the speed of one particular
enemy without affecting all the others, so be careful!
Page 15 of 21
V1.0, 18/01/2016
As noted earlier, indestructible enemies can move up and down as well as left and right. To achieve
this, use the goUp and goDown arrows as well as goLeft and goRight arrows to create something like
this:
Note that in this setup the moveDirection for the enemy is set to 180 so when the level starts it
begins to move left. The other option would be 0 to make it move right. If it was set to either 90 or
270 it would miss the other arrows and disappear off the screen, so be careful!
Bear in mind that you dont have to use up, down, left and right if you dont want to. These setups
are also perfectly valid:
Page 16 of 21
V1.0, 18/01/2016
Coins
Most games, especially platform games, include items that the player can collect to earn points and
increase their score and Platformer Template is no different.
Coin object
Bronze
Silver
Gold
The game is set up so that coins will automatically spin and disappear when the player collides with
them to collect them.
Page 17 of 21
V1.0, 18/01/2016
When the player picks up a coin they automatically receive points as follows:
Bronze 25
Silver 50
Gold 100
Page 18 of 21
V1.0, 18/01/2016
Common Problems
Here Ive tried to collect some things that might catch you out when using Platformer Template or
this documentation. Im sure this will be the most commonly amended part of this document as I get
more and more questions about how and why things work (or dont work)!
Q. The documentation tells me to get an item from the Objects panel, but it isnt there!
A. Items only appear in the Objects panel if they have already been added to your Layout. If the item
you want isnt there, then look in the Projects panel, in the Object types folder.
Page 19 of 21
V1.0, 18/01/2016
Document History
Page 20 of 21
V1.0, 18/01/2016
Credits
I would like to offer sincere and heartfelt thanks to the following people:
The good folks at itch.io for creating an excellent website that allows creators everywhere to share
their work with the world.
Kenney Vleugels for creating so many wonderful assets and sharing them with the world.
Page 21 of 21