(4) The Player
Creating the Player (Discussion)
Creating the Player (Discussion)
So that we can control the initial properties of certain Game Objects when they are first created
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
We create a temporary layout to store them
This layout is not used in the game as a level
This layout is not used in the game as a level
It is just our source of pre-configured game objects.
It is just our source of pre-configured game objects.
65 Add a new Layout
65 Add a new Layout
Call it Temp
Call it Temp
66 Add a new sprite to the Temp layout
66 Add a new sprite to the Temp layout
Call it Player
Call it Player
Import the animations from the sprite strips:
Import the animations from the sprite strips:
(Idle, Run, Fall, DoubleJump, Hit, Jump, WallJump)
(Idle, Run, Fall, DoubleJump, Hit, Jump, WallJump)
Rename the animation to Idle
Rename the animation to Idle
Set all multi-frame animations speed to 20 fps and loop
Set all multi-frame animations speed to 20 fps and loop
Leave single-frame animations speed at 5fps and don't loop.
Leave single-frame animations speed at 5fps and don't loop.
Recommended size for Player is same size as mushroom
Recommended size for Player is same size as mushroom
67 Create an Event Sheet for the Player if you have not done so already
67 Create an Event Sheet for the Player if you have not done so already
Call it evPlayer
Call it evPlayer
Add it to the General folder
Add it to the General folder
68 Open evLevel1 Event Sheet
68 Open evLevel1 Event Sheet
Include evPlayer if you have not done it previously
Include evPlayer if you have not done it previously
Now we can keep all player functions in one place.
Now we can keep all player functions in one place.
69
69
Play with the settings of the player controller (yellow box)
Play with the settings of the player controller (yellow box)
Recommended settings are shown LEFT.
Recommended settings are shown LEFT.
70 Move the Player object into the Player folder
70 Move the Player object into the Player folder
Create a new Object Types subfolder
Create a new Object Types subfolder
Call it Plugins
Call it Plugins
Add the Keyboard Object
Add the Keyboard Object
Player Portrait and Health Bar
Player Portrait and Health Bar
71 Download this image and use it as your PlayerPortrait Sprite (Right click and save image as)
71 Download this image and use it as your PlayerPortrait Sprite (Right click and save image as)
<--- image
<--- image
72 Use these 4 images for your PlayerHearts frames
72 Use these 4 images for your PlayerHearts frames
73 Use this image for your PlayerDeath Sprite
73 Use this image for your PlayerDeath Sprite
Put it on the Temp Layout
Put it on the Temp Layout
Untick initially visible
Untick initially visible
Give it the Platform Behaviour and untick default controls
Give it the Platform Behaviour and untick default controls
Add the Rotation Behaviour and use settings as shown
Add the Rotation Behaviour and use settings as shown
74 Put the 3 new Player Sprites you downloaded in the Player Folder
74 Put the 3 new Player Sprites you downloaded in the Player Folder
NOTE: The Player Sprite represents only how the player LOOKS
NOTE: The Player Sprite represents only how the player LOOKS
It is only the players APPEARANCE and ANIMATIONS
It is only the players APPEARANCE and ANIMATIONS
The player object which we control will just be the player controller (yellow box).
The player object which we control will just be the player controller (yellow box).
This is often called the HitBox or HurtBox.
This is often called the HitBox or HurtBox.
All the code logic will operate on this box.
All the code logic will operate on this box.
We will pin the sprites with their animations to this box.
We will pin the sprites with their animations to this box.
It will appear as if the sprites are being controlled.
It will appear as if the sprites are being controlled.
75 Set the player controller initially visible to false
75 Set the player controller initially visible to false
76 In the Player Evsheet Link the Player Animator (Player) and the Player Controller (PlayerController)
76 In the Player Evsheet Link the Player Animator (Player) and the Player Controller (PlayerController)