D
Danr96
Guest
So I have a game where I switch sides using this code:
if(mouse_check_button_pressed(mb_left) && (mouse_x < room_width / 2) && playerLeft = 0 && grounded) {
playerLeft = 1;
playerRight = 0;
x = (room_width / 2) - 66;
//image_xscale = 1;
}
if(mouse_check_button_pressed(mb_left) && (mouse_x > room_width / 2) && playerRight = 0 && grounded) {
playerRight = 1;
playerLeft = 0;
x = (room_width / 2) + 66;
//image_xscale = -1;
}
Then I have the ability to jump on each side using this code:
if(mouse_check_button_pressed(mb_left) && (mouse_x < room_width / 2) && jumps = 2 && playerLeft == 1) {
jumps -= 1;
horizontalSpeed = -jumpSpeed;
} else if(mouse_check_button_pressed(mb_right) && (mouse_x < room_width / 2) && jumps = 1 && playerLeft == 1) {
jumps -=1;
horizontalSpeed = -jumpSpeed2;
}
if(mouse_check_button_pressed(mb_left) && (mouse_x > room_width / 2) && jumps = 2 && playerRight == 1) {
jumps -= 1;
horizontalSpeed = jumpSpeed;
} else if(mouse_check_button_pressed(mb_right) && (mouse_x > room_width / 2) && jumps = 1 && playerRight == 1) {
jumps -=1;
horizontalSpeed = jumpSpeed2;
}
When on both sides it allows you to jump twice.. But when you switch side and try to jump instantly there is a delay of about 1 second.. I was hoping someone would be able to help me resolve the issue.
if(mouse_check_button_pressed(mb_left) && (mouse_x < room_width / 2) && playerLeft = 0 && grounded) {
playerLeft = 1;
playerRight = 0;
x = (room_width / 2) - 66;
//image_xscale = 1;
}
if(mouse_check_button_pressed(mb_left) && (mouse_x > room_width / 2) && playerRight = 0 && grounded) {
playerRight = 1;
playerLeft = 0;
x = (room_width / 2) + 66;
//image_xscale = -1;
}
Then I have the ability to jump on each side using this code:
if(mouse_check_button_pressed(mb_left) && (mouse_x < room_width / 2) && jumps = 2 && playerLeft == 1) {
jumps -= 1;
horizontalSpeed = -jumpSpeed;
} else if(mouse_check_button_pressed(mb_right) && (mouse_x < room_width / 2) && jumps = 1 && playerLeft == 1) {
jumps -=1;
horizontalSpeed = -jumpSpeed2;
}
if(mouse_check_button_pressed(mb_left) && (mouse_x > room_width / 2) && jumps = 2 && playerRight == 1) {
jumps -= 1;
horizontalSpeed = jumpSpeed;
} else if(mouse_check_button_pressed(mb_right) && (mouse_x > room_width / 2) && jumps = 1 && playerRight == 1) {
jumps -=1;
horizontalSpeed = jumpSpeed2;
}
When on both sides it allows you to jump twice.. But when you switch side and try to jump instantly there is a delay of about 1 second.. I was hoping someone would be able to help me resolve the issue.