I have a dash function in my game as well as a jump function. Both of them works completely fine all by themselves. The jump works find and the dash works fine, however, I want to be able to jump cancel from my dash. During my dash, when I try to hit the jump button, the charater object moves horizontally instead of vertically. It almost acts as a second dash.
What I want to happen is the character to be able to jump vertically out of my characters dash. Can someone guide me in the right direction to my desired results?
if (keyboard_check(ord("D")) && !place_meeting(x + 2, y, obj_hitbox_wall)) {
x += 2;
image_xscale =+1;
directionFacing = "Right";
}
if (keyboard_check(ord("A")) && !place_meeting(x - 2, y, obj_hitbox_wall)) {
x -= 2;
image_xscale =-1;
directionFacing = "Left";
}
///// WALL HIT DETECTION START /////
if (!place_meeting(x,y+2,obj_hitbox_wall)){
gravity = .25;
grounded = false;
} else {
vspeed = 0;
gravity = 0;
grounded = true;
jumpDash = false;
}
///// WALL HIT DETECTION STOP /////
///// DOUBLE JUMP PROPERTIES START /////
if (grounded == false && jumped == true) {
if (keyboard_check_pressed(vk_space)) {
vspeed = 0;
vspeed -= 5;
jumped = false;
}
}
if (grounded == true) {
if (keyboard_check_pressed(vk_space)) {
vspeed -=5;
jumped = true;
}
}
///// DOUBLE JUMP PROPERTIES END /////
///// DASH PROPERTIES START /////
if (dashed == false && keyboard_check_pressed(vk_shift) && jumpDash == false) {
if (directionFacing = "Right") {
vspeed = 0;
gravity = 0;
speed += 8;
dashed = true;
}
if (directionFacing = "Left") {
vspeed = 0;
gravity = 0;
if (grounded == true) {
speed -= 8;
} else {
speed+=8;
}
dashed = true;
}
}
if (dashed == true && directionFacing = "Right") {
speed -= .4;
direction = 0;
if (speed <= 0) {
dashed = false;
gravity = .25;
speed = 0;
}
}
if (dashed == true && directionFacing = "Left") {
if (grounded == true){
speed += .4;
direction = 0;
} else {
speed -= .4;
direction = 180;
}
if (grounded == true && speed >= 0) {
dashed = false;
gravity = .25;
speed = 0
} else if (grounded == false && speed <= 0) {
dashed = false;
gravity = .25;
speed = 0
}
}
///// DASH PROPERTIES END /////
///// JUMP DASH PROPERTIES START /////
if (grounded == false && dashed == true) {
jumpDash = true;
}
///// JUMP DASH PROPERTIES END /////