S
Soco
Guest
I got a wall jumping character in my game, but he is able to wall jump while he's falling simply by pressing the opposite direction key. Which I'd like him to not be able to do...I thought my code would be quite simple, but it's not working and I'd like it to work. =) This is what I've come up with so far and when I add a show_debug statement to see my "falling" variable, it always says 0...falling is always coming back as true. The problem must be with the "falling" variable not reading correctly?
Code:
//Movement
var falling = y-yprevious > 0;
show_debug_message(string(falling));
if (right) {
hspd += acc;
hspd_dir = right - left;
face = RIGHT;
if (hspd > spd) hspd = spd;
if (hspd < -spd) hspd = -spd;
//Wall Jump
if (!falling){
if (place_meeting(x-1, y, obj_Solid) && !place_meeting(x, y+1, obj_Solid) && !left) {
vspd = -16;
hspd +=acc;
}
}
}else{
if (left) {
hspd += -acc;
hspd_dir = right - left;
face = LEFT;
if (hspd > spd) hspd = spd;
if (hspd < -spd) hspd = -spd;
//Wall Jump
if (!falling){
if (place_meeting(x+1, y, obj_Solid) && !place_meeting(x, y+1, obj_Solid) && !right) {
vspd = -16;
hspd += -acc;
}
}