Created
October 12, 2022 19:02
-
-
Save furenku/77b5baa06bca2ed76d7c00ace280b2f1 to your computer and use it in GitHub Desktop.
arrow handling in p5.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function keyPressed() { | |
switch( key ) { | |
case "ArrowUp": | |
myObject.position.y -= 0.025 | |
break; | |
case "ArrowRight": | |
myObject.position.x += 0.025 | |
break; | |
case "ArrowDown": | |
myObject.position.y += 0.025 | |
break; | |
case "ArrowLeft": | |
myObject.position.x -= 0.025 | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment