Skip to content

Instantly share code, notes, and snippets.

@furenku
Created October 12, 2022 19:02
Show Gist options
  • Save furenku/77b5baa06bca2ed76d7c00ace280b2f1 to your computer and use it in GitHub Desktop.
Save furenku/77b5baa06bca2ed76d7c00ace280b2f1 to your computer and use it in GitHub Desktop.
arrow handling in p5.js
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