(4) The Player

Creating the Player (Discussion)

So that we can control the initial properties of certain Game Objects when they are first created

We create a temporary layout to store them

This layout is not used in the game as a level

It is just our source of pre-configured game objects.

65 Add a new Layout

Call it Temp

66 Add a new sprite to the Temp layout

Call it Player

Import the animations from the sprite strips:

(Idle, Run, Fall, DoubleJump, Hit, Jump, WallJump)

Rename the animation to Idle

Set all multi-frame animations speed to 20 fps and loop

Leave single-frame animations speed at 5fps and don't loop.

Recommended size for Player is 48 x 48

67 Create an Event Sheet for the Player

Call it evPlayer

Add it to the General folder

68 Open evLevel1 Event Sheet

Include evPlayer

Now we can keep all player functions in one place.

69 Add Platform behaviour to the Player

Play with the settings

Recommended settings are shown LEFT.




70 Move the Player object into the Player folder

Create a new Object Types subfolder

Call it Plugins

Add the Keyboard Object

Player Portrait and Health Bar

71 Download this image and use it as your PlayerPortrait Sprite (Right click and save image as)

Untick initially visible

<--- image

72 Use these images for your PlayerHearts frames

Untick initially visible

73 Use this image for your PlayerDeath Sprite

Put it on the Temp Layout

Untick initially visible

Give it the Platform Behaviour

Add the Rotation Behaviour and use settings as shown

74 Put the 3 new Player Sprites you downloaded in the Player Folder

NOTE: The Player Sprite represents only how the player LOOKS

It is only the players APPEARANCE and ANIMATIONS

The player object which we control will just be a box.

This is often called the HitBox or HurtBox.


All the code logic will operate on this box.

We will pin the sprites with their animations to this box.

It will appear as if the sprites are being controlled.

75 Create a new sprite and make it a yellow box.

Set its size to 40 x 40

Set initially visible to false

76 Link the Player Animator (Player) and the Player Controller (PlayerController)