• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Weird jump input issue

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.

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);
   }
Thank you guys in advance!
 
B

BlazingMuffinz

Guest
Nvm i just fixed my own code after a week of troubleshooting lol
 
Top