After adding the dash, wall jump and double jump, I then had to add the conditions for if the player is in water or sliding down a ramp, so these are the changes made to the previous code, to allow these events. If the player hits the slide, it overrides the movement and forces the player to move in the direction of the ramp so the player has to time a ramp, and for the water it simply just affects the gravity to make the player float.
var InWater = place_meeting(x,y-32,oWater);
var onSlide = place_meeting(x,y+2,oSlide);
if (dashduration > 0) {vsp = 0;}
else if (onWall != 0) {vsp = min(vsp + 0.2, 3);}
else if (InWater != 0) {vsp = min(vsp + 0.2, 5);}
else {vsp = vsp + grv;}
if (onSlide = 1) // Need to change so theres two varients for left and right
{
image_angle = -45;
sprite_index = sPlayerSlide;
hsp = hsp + 5;
vsp = vsp + 5;
}
else {
hsp = move * walksp; //THIS IS THE MOVEMENT
}
if (onGround = 1 && onSlide = 0)
{vsp = -12;
jumps = 1;
}
if (InWater = 1)
{vsp = -12;
jumps = 2;
}
key_left = keyboard_check(vk_left) || (gamepad_axis_value(0,gp_axislh) < 0); //first function yellow text //vk = virtual keyboard
key_right = keyboard_check(vk_right) || (gamepad_axis_value(0,gp_axislh) > 0);
key_jump = keyboard_check_pressed(vk_space) || gamepad_button_check_pressed(0, gp_face1);
var dash = keyboard_check_pressed(ord("Q")) || gamepad_button_check_pressed(0, gp_face2);
if(keyboard_check_pressed(vk_left) || (gamepad_axis_value(0,gp_axislh) < 0))
{lastpressed = "left";}
if(keyboard_check_pressed(vk_right) || (gamepad_axis_value(0,gp_axislh) > 0))
{lastpressed = "right";}
Here I am updating the checks for the controls to include controller controls so that the game can be played using a keyboard or controller. This is very simply done using the OR function to check for button presses or controller buttons. The biggest problem with this was that the controller uses an axis for the joycon which meant I had to figure out the deadzone for the correct amount of movement and the trigger. I also added a last pressed function which stored a string with either left or right. this is to be used later for the sprite changes from left to right and to check what the last direction the player was moving was.