Help with key variable
in
Programming Questions
•
1 year ago
What I have right now is this:
- if(keyPressed){
- switch(key){
- case 'a':
- //Move Left break;
- case 'd':
- //Move Right break;
- case 'w':
- //Jump break;
- }
- }
This is for a character to move, obviously. Whenever the character is moving left or right, and I press jump, he stops moving and only jumps, then I have to press the key down again. How would I solve this?
1