Created
March 10, 2015 07:26
-
-
Save brunokruse/ae565589eec54ed39ecb to your computer and use it in GitHub Desktop.
Class Example
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
// Arrows and WASD example | |
void setup() { | |
} | |
void draw() { | |
} | |
void keyPressed() { | |
// WASD | |
if (key == 'w' || key == 'W') { | |
// move up | |
println("w"); | |
} | |
if (key == 'a' || key == 'A') { | |
// move left | |
println("a"); | |
} | |
if (key == 's' || key == 'S') { | |
// move down | |
println("s"); | |
} | |
if (key == 'd' || key == 'D') { | |
// move right | |
println("d"); | |
} | |
// ARROW KEYS | |
if (keyCode == UP) { | |
// move up | |
println("up arrow"); | |
} | |
if (keyCode == DOWN) { | |
// move down | |
println("down arrow"); | |
} | |
if (keyCode == LEFT) { | |
// move left | |
println("left arrow"); | |
} | |
if (keyCode == RIGHT) { | |
// move right | |
println("right arrow"); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment