Unit 5 – Platform and Player Behavior

Items In This Unit
- Platform and Player Tutorial
The Platform and Player Tutorial
So far, we have learned how to add conditions (statements when something occurs) and actions (what to do when a condition occurs). Next, we will learn about object behaviours. Object behaviours are built-in characteristics that can be applied to specific objects. This is to save you time to program the behaviours yourself. Most games genres reuse the same standard behaviours from one game to another. There is no need to reinvent the wheel and to re-create these behaviours repeatedly.
The platform behaviour is a built-in feature of GD which provides the player with standard platform behaviour which includes basic motion and movements including jumps. When you add a platform and assign it the platform behaviour you have the basic elements of a platformer game.
Alright, let’s get started. The objective of this exercise is to get you thinking about how you might want to design a platformer game.
The following table describes the steps needed to start creating a platformer video game. Note that we will not be showing screenshots for every single click as by now you should be more familiar with GD.
Step |
Instructions |
1 |
Open GDevelop on your computer. |
2 |
Click on Create a new game |
3 |
Choose Empty game |
4 |
Create a new scene as before calling it “Level 1”. |
5 |
Double click on the new scene. You should see the following screen. |
6 |
Click on “Add a new object”, then choose “Sprite” |
7 |
For object name enter: GrassPlatform |
8 |
Click on “+ Add an animation” You should see the following screen. |
9 |
Click on “Edit with Piskel” |
10 |
You should see a screen that looks like this..
Width: 128 |
11 |
Click on the Paint bucket tool as indicated below Click on the colour selector tool (black square) as shown below to change the primary colour. Pick a shade of green to represent the colour of grass. |
12 |
Next, with you, the mouse pointer clicks anywhere within the sprite’s rectangle. Your screen should look like this. |
13 |
At the very top of the screen rename the default name to say “grass” instead of “NewObject” |
14 |
Click on the “Save” button near the top right corner of the window. |
15 |
Next, you should see the following. |
16 |
Click on Apply at the bottom right of the dialogue box. |
17 |
You should now see the grass platform sprite within the Objects pane on the rights side as shown. |
18 |
Next, let’s create our player sprite in a similar way. Click on “Add a new object”. |
19 |
Choose Sprite for the object type and call it “Player” |
20 |
Click on “+ Add an animation”. You should see the following. |
21 |
Click on “Edit with Piskel”. You should see the following. If your screen looks different, locate and click on the following icon:
Width: 128 |
22 |
Next, using the pen tool (and any others) draw your player. You can draw anything you like. We will use a simple stick figure. |
23 |
Change the default sprite animation name on the very top to “player” then click on the Save button on the top right. |
24 |
You should see the following. Click on Apply |
25 |
At this point, we have 2 sprites as shown below. |
26 |
Next, click on the 3 dots next to GrassPlatform, then select edit object. |
27 |
Click on the behaviours tab |
28 |
Click on “Add a behaviour to the object”. You should see the following. Click on Platform. You should see the following. Click on Apply. |
29 |
Next, do the same for the Player object, this time choose “Platformer character” for the behaviour. |
30 |
Next, drag and drop the GrassPlatform to the game design area. Your screen should look like the following. |
31 |
Spawn a few more grass platform objects by holding down the control key while dragging new platforms. We made ours look as follows… |
32 |
Next, drag and drop the Player sprite onto one of the platforms. Your screen should look like the following. |
33 |
Click on the game Preview button. |
34 |
Use the array keys and the spacebar to move around and jump on your platforms. |
Congrats! You have learned the following in this lecture:
- How to create a platform sprite
- How to add a platform behaviour to platform sprite
- How to create a player sprite
- How to add platform movements to a player sprite
Next, we will learn about setting boundaries for player movements.
Game Files/Resources
You can download the files from the link below.