Windows Help & Advice – May 2019

(Joyce) #1

46 |^ |^ May 2019


under ‘resources/examples/platformer’. Choose Grass.png,
then back in the Properties window, click Apply.
You can now place your platform somewhere in the playing
field. Click and drag the platform into the centre, and just
dump it wherever you feel is best. You now have a tile of a
grass platform, but that’s not much use, so now let’s
demonstrate the program’s coolest feature.
If you click the platform, some little white boxes appear –
these are resize controls. Click and drag them, and GDevelop
generates more platforms based on the pattern of the
original. Cooler still, the top box is a rotational control,
allowing for platforms of any angle.
We still need to tell GDevelop this is a platform, otherwise
your character will fall through it. In the Objects panel,
right-click GrassPlatform, and choose ‘Edit object’. In the new
window, open the Behaviors tab, and click the ‘+’ sign on the
right to add a behaviour. In the new window, click Platform,
then click Apply in the window that follows. Now that you
have a platform to walk on, let’s put something on it.


Give it character
We’ll prepare the main character by assigning controls, then
use images from the tutorials to make the character run and
stand still. To create a new character, add a new object from
the Objects pane. In the new window, click Sprite, which
opens Properties for the new character, and renames it Player.
To assign controls to Player, click the Behaviors tab, and on
the right is a ‘+’ sign to add behaviours. From the new menu,
choose ‘Platform character’, which brings up a new screen of
settings. We’ll just use the defaults for now, so click Apply.
Now to give Player some animation. From the Objects
panel, right-click Player, and choose ‘Edit object’, which


opens the Properties tab. We need two lines of
animation, so click the ‘+’ sign on the right twice. You
now have two unnamed lines of animation, called
Animation #0 ‘Idle’ and Animation #2 ‘Running’.
To choose the animation images, click the big white
square on the left with a ‘+’ sign, which opens a file
browser window, and open the same platformer
folder as before. For the Idle animation, load p1_
stand.png. The Running animation is made of five
images, so create five frames, and load the images
p1_w a l k 03. p n g through to p1_w a l k 07. p n g.
There’s just one last tweak that we need to make
before moving on. With the Running animation, click
‘Don’t Loop’, so that it changes mode to Loop, and
with the timer icon, delete the 1 and change it to
0.05, which will speed up the animation.

Main event
Now for the hard part. Open the New Scene (Events)
tab [see Image C], and you’ll be in the event editor.
This is the nitty gritty, the nuts and bolts, the engine
room of gaming.
Events are made of Conditions (on the left) and
Actions (on the right). If a condition is true – for
instance, ‘Laser is in collision with Enemy’ – it
triggers an action, such as ‘Delete object Enemy’.
A chain of these events is what is known as an
algorithm, and these algorithms are ultimately the
design that makes a videogame work. As you’ll
discover, the algorithms required for a game can
quickly become complex, even for seemingly
basic functions.
For instance, can a platform be grabbed? How do
you make it ‘grabbable’? What changes need to be
made to the character, and what effect will this have
on the game physics? Working this stuff out can be a
nightmare, but thankfully, GDevelop has a selection
of typical genre-specific behaviours that have been
pre-programmed for you, and are ready to use.
To create your first event, click the ‘Add a new
empty event’ button from the toolbar. With the
new empty event showing, click ‘Add condition’.
Our first bit of coding is to check whether the player
is on the floor (aka the platform). A large menu
appears with all of the conditions available in
GDevelop. Scroll down to Platform Behavior
and choose ‘Is on floor’.
On the right is where you assign an object to this
behaviour, and configure any parameters. Click in the
‘Object field’ and an auto-complete menu appears
with all the in-game objects. Choose ‘Player’ and click
outside the field to make it go away. This is all that’s
needed, so click OK to return to the event editor.

A sub-event
Normally here, we would follow the usual chain of
adding an action to go with the condition, but we’d
much rather take the opportunity to demonstrate
sub-events for the purposes of this demo. You could
use two normal events to fill in the logic that:
t *GUIFQMBZFSJTPOUIFHSPVOEBOEOPUSVOOJOH

the Idle animation must play.
t *GUIFQMBZFSJTPOUIFHSPVOEBOESVOOJOH
UIF
Running animation must play.
However, if you’re going to use sub-events, you
only need check whether the player is on the
ground once, which thankfully, makes the code
cleaner and easier to troubleshoot.
To create a sub-event, go to the ‘Player is on floor’
event, right-click the blank space next to ‘Add a
condition’, and choose Add Sub Event. You’ll need to
do this twice, because you need two sub-events. The

Sometimes GDevelop can get obtuse, but Piskel is relatively
straightforward. The central area is where you draw, the chequered
grey background signifying transparency. If you want to create a
VHULHVRILPDJHVEDVHGRQDQLQLWLDOWHPSODWHGUDZ\RXUÀUVWLPDJH
DQGWKHQDGGWKHQXPEHURIIUDPHV\RXZDQWWRÀOO,QWKH
Transform box, you can now click the Clone icon.
To see your work, toward the top-right corner is a preview
window showing all of the animation frames playing in sequence.
If you look just below the previewer, there is a slider showing the
number of FPS (frames per second). When you’re done, click
‘Save to GDevelop’ over in the far top-right corner.

Piskel


The animation editor


B
Free download pdf