B
BlazingMuffinz
Guest
Hello all! I just have a quick question regarding my code for my game. For some reason when my character jumps and I tap the right arrow key (to make it move right) it doesn't stop moving right until it touches the ground. When I press and release the left arrow key my character falls straight down like it is supposed to. Every time I've tried to fix it I make it so the right side behaves correctly, but the left side loses the ability to move in the air. Can you help a brotha out?
I believe these lines are the culprit, but I honestly don't know, I'm pretty new to this.
Thank you guys in advance!
I believe these lines are the culprit, but I honestly don't know, I'm pretty new to this.
Code:
var inputX = rightHold() - leftHold();
if(inputX!=0 and phase!=2){
facing = inputX;
if(vx*facing<0) vx = approach(vx, 0,airFric);
vx = approach(vx,facing*walkSpeedMax,airAccel);
}