In this page I will show you how to add the following mechanics to your game:
Ladder climbing
Double Jump
Slippery Ice Block
Running
Wall Jump
Rope swing aka Grapple hook
First we need to make a ladder object that will be a 64 x 64 sprite with a top left origin call is sLadder
Name the ladder oLadder no code is needed for the ladder
When the player collides with the oLadder the state will change to "climb" state
While in the climb state the sprite will change to a sPlayerClimb sprite that we need to make lucky that the LPC sprite generator has a climbing sprite
It has 6 frames is 64 x 64 px and the vertical cell offset is 21
Like all your animated sprites make this have a middle center origin
.Creating the Climbing Pose
Game maker does not automatically use the LPC style sheet we have to convert it to different poses
Click on Add Sprite Icon click load sprite and then select Edit Sprite
Select Image Pull Down Menu and click Import Strip Image and load your character sprite
Number of images and number of rows is 9
Image width should be 64
Image height should be 64
Vertical cell offset is 11
Click Convert
If your character has a colored background select Image Erase a color to make it transparent.
Save as sPlayerClimb
Select Middle Center for the sprite
We will make these new mechanics as scripts so the step event code of oPlayer doesn't have to be changed (It will change a bit)
First we have to think about all the things we want to do with this climbing mechanic.
If we collide with ladder and press "W" key we want the sprite to change to the sPlayerClimb sprite and begin to climb up
We want the player to be able to walk through ladders staying in the walk or idle states this is why we will check if we or pressing the W key and colliding with oLadder
If we move on ladder we want to animate sprite
We can climb between platforms
We can walk off ladders
We can move left and right on ladder
We cannot attack while on ladder
We cannot climb through platforms
First lets add our climbing speed variable
Open your oStart object and add the new global variable under the other two global variables in the Create Event
//Variables this is your move speed and jumping distance
global.movespeed = 5;
global.jumpspeed = 20;
// New Global for Climbing Speed
global.climb_speed = 3;
Now we will modify our STEP Event code in your oPlayer object
In the Get Player Input area we are going to add two more keyboard checks so we can hold down the W key to climb Up or hold down the S key to climb down
// Get player input
key_right = keyboard_check(ord("D"));
key_left = -keyboard_check(ord("A"));
key_jump = keyboard_check_pressed(ord("W"));
attack = mouse_check_button_pressed(mb_left);
wepselect = keyboard_check_pressed(ord("S"));
key_up = keyboard_check(ord("W"));
key_down = keyboard_check(ord("S"));
Now after we React to inputs we will check for the collision is the oLadder object
Place this code into the STEP EVENT of oPlayer inbetween the react to inputs and the Jumping and Gravity section
this will put us in a "climb" state if you are colliding with oLadder, turn off gravity and set our vertical and horizontal movement speeds
//Climbing Collision
if place_meeting(x,y,oLadder)
{
state = "climb"
hsp=0;
vsp=0;
grav = 0;
vsp = global.climb_speed * (key_down - key_up);
hsp = move * global.movespeed * movefactor;
}
else
grav = 1;
Picture below shows where to place code
Now we will add a new Case in the switch statement for "climb"
This code will make our character animate when moving or stop animating when not climbing on ladder make sure you change the sprite name to the the name you gave your climbing sprite
Add this code to the bottom of the switch statement
case "climb":
sprite_index = sPlayerClimb;
image_xscale=facing;
if vsp==0
subimage=0;
else
subimage=-1;
break;
}
Picture below shows where to add code
To disable attacking of oPlayer while climbing we will change the attack code
At the bottom of the step event of oPLayer change the attack state code by adding a check for NOT being in "climb" state
Remember when you use the != syntax that means NOT equal so you can only attack if your NOT is a climb state
//Attack state
if canattack==1 && wep=="spear" && state != "climb"
state = "attackspear";
if canattack==1 && wep=="bow" && state != "climb"
state = "attackbow";
This code will make sure you return to idle state at the end of each frame or step in your game Test your game you should now be able to climb up and down ladder objects if you want to add other types of ladders just make new objects like a vine or metal ladder etc then make it a child of oLadder
if move==0 && state!="attackspear" && state !="attackbow" && state !="climb"
{
state="idle";
}
We will now show you how to do a double jump effect we will make this an upgrade so you have to collect super shoes to give you this ability
First lets make an object that can be dropped by a monster or found in your room somewhere
Make a sprite 64px Top Left origin for the shoe name sShoe now create an object oShoe
When your oPlayer collides with the oShoe we need to use a variable that keeps track of you gaining power up we will use a global variable called global.maxjumps that will keep track of how many jumps you can make it will be set to 1 when the game starts and once you collect the shoes it will increase to 2. Open you oStart object and add this variable to the Create Event
Your entire event should look like this now
//Variables this is your move speed and jumping distance
global.movespeed = 5;
global.jumpspeed = 20;
// New Global for Climbing Speed
global.climb_speed = 3;
//Keep track of how many jumps you can make
global.jumpsmax = 1;
Now open oPlayer and add jumps variable to Create Event to keep track of how many jumps you have made
Add this variable to the end of your Create Event for oPlayer
// New variables double jump
jumps = 0;
We need to be able to set the amount of jumps you can perform anytime you are standing on a oBlock so we add the jumps = global.jumpsmax;
Then when you press the jump key and you have jumps to perform you can jump even in the air then we subtract one jump each time so this could make you jump as many times as you want just continue to add to the global.jumpsmax variable if it is 5 you can jump 5 times
Now add this code to the STEP Event of you oPlayer replacing the jump code with this new code
//Jumping
if place_meeting(x,y+1,oBlock)
{
jumps = global.jumpsmax;
}
if (key_jump) && (jumps > 0)
{
jumps -=1;
vsp = key_jump * -global.jumpspeed;
}
When you collide with the oShoe object we will increase the global.jumpsmax variable by one
Add a collision Event to oPlayer with oShoe
Add this code to destroy the oShoe object and increase the max jumps then add oShoe to room and test your double jump skills
global.jumpsmax +=1;
with other
instance_destroy();
Find or make a 64px sprite for an Ice Block this will be a special block like oHurt, oJump and oWater objects.
This object will make you slip when changing directions make
Now create an object called oIce and make it a child of oBlock so you can walk on it and jump on it
Now prepare you room by adding some ice areas
Open oPlayer object and we will adjust the STEP EVENT code to use new slippery ice
Find the //React to inputs section and modify it to this I have commented to code so that you can change the local variables to make it more or less slippery or make you slower on ice than on regular oBlock objects all your jumping has been preserved by making the oIce object a child of oBlock
We are using a new function in the code called clamp this code limits a variable to stay between two numbers so in our case the hsp is limited to negative max_ice_speed and positive max_ice_speed
//React to inputs
move = key_right + key_left;
// --- New Local Variables for Slippery Movement ---
var on_ice = place_meeting(x, y+1, oIce);
var friction_factor = 1;
// --- Horizontal Movement Logic ---
if (on_ice)
{
// On Ice: Apply acceleration and friction
// 1. Acceleration (slower movement response)
var acceleration = 0.5; // Adjust this value (e.g., 0.5 for slow start)
hsp += move * acceleration;
// 2. Limit Speed
var max_ice_speed = global.movespeed * 0.75; // Adjust max speed on ice
hsp = clamp(hsp, -max_ice_speed, max_ice_speed);
// 3. Friction (only if player is not actively moving)
// This makes the player slide if they stop pressing keys
if (move == 0)
{
friction_factor = 0.96; // Adjust this value (closer to 1 = less friction, more slide)
hsp *= friction_factor;
// Stop movement if speed is near zero
if (abs(hsp) < 0.1) hsp = 0;
}
else // Player is actively moving, so we keep the friction low
{
// Add a slight resistance even while moving
hsp *= 0.99;
}
}
else // Not on Ice: Use normal ground movement
{
// Normal Ground Movement (Instant speed change)
hsp = move * global.movespeed * movefactor;
}
We want your character to be able to run when holding down the shift button to double your speed
We have everything in place to make this happen remember we have a variable called movefactor that slows oPlayer down when walking through water
We can use this variable to make your player run faster as well
First lets make the new running sprite import your LPC sprite and find the running pose it will have the following:
Creating the Running Pose
Game maker does not automatically use the LPC style sheet we have to convert it to different poses
Click on Add Sprite Icon click load sprite and then select Edit Sprite
Select Image Pull Down Menu and click Import Strip Image and load your character sprite
Number of images and number of rows is 8
Image width should be 64
Image height should be 64
Vertical cell offset is 41
Click Convert
If your character has a colored background select Image Erase a color to make it transparent.
Save as sPlayerRun
Select Middle Center for the sprite
Open your oPlayer object and add this to the STEP EVENT in the get player input section add this new key to keep track of whether you are holding down the shift key
key_run = keyboard_check(vk_shift);
Now if you hold down shift while walking you will start to run and double speed
Add this code to the STEP EVENT of oPlayer under the React to inputs section this will check if your are moving and holding down the shift key this will double your global.movespeed by multiplying by movefactor of 2
//Set Run Speed if key_run is held down
if (key_run) && move!=0
{
movefactor = 2;
state = "run"
}
else
movefactor = 1;
Under the special Blocks code change this code to allow you to change the animation direction while running
///Change States While Moving
if move==1 && canattack==0
{
facing = key_right;
if state !="run"
state="walk";
}
if move==-1 && canattack==0
{
facing = key_left;
if state !="run"
state="walk";
}
In the Animate Character section add a new case when in a "run" state put this code inside the switch statement after the "climb" case this will animate your character when running
case "run":
sprite_index = sPlayerRun
image_xscale=facing;
subimage=-1;
break;
At the end of the STEP Event of oPlayer replace your change states to this will make sure that each frame you state will be reset based upon player input
//Resets the state at end of STEP
if move==0 && state!="attackspear" && state !="attackbow" && state !="climb" && state !="run"
{
state="idle";
}
Adding wall jump is very easy before you Special Block code add this to enable wall jump this will check if you are colliding horizontally with a oBlock either to the oPlayers right or left and pressing the key_jump key this will give you a jump
// Wall Jumping
if (key_jump) && ((place_meeting(x+1,y,oBlock)) || place_meeting(x-1,y,oBlock))
{
vsp = key_jump * -global.jumpspeed;
}
Now lets add a grapple hook where if you right click on a platform it will hook the block and allow you to swing or climb the grapple line