Im a beginner and I am curious about how to do something.
I'm trying to make an extremely basic mario style game using p5js and sublime text 2 just so that I can learn, and I currently have it so that every time i press the right key "mario's" (mario is a rectangle) x position increases by 5. But it only happens each time i press the key. the way i'm doing it is
if(keyCode === RIGHT_ARROW) mario.move(15)
the number paramater is how much his x will move by. so rather than saying if they key is pressed, can i make it say if the key is being held down? Thanks. I can provide all code if its needed for some reason
Posted Feb 17, 2017, 3:12 AM UTC · edited
34