Skip to content

Instantly share code, notes, and snippets.

@zeroeth
Created July 22, 2013 19:22
Show Gist options
  • Select an option

  • Save zeroeth/6056789 to your computer and use it in GitHub Desktop.

Select an option

Save zeroeth/6056789 to your computer and use it in GitHub Desktop.
mouse and key input
int radius = 400;
int positionX = 10;
int positionY = 10;
void setup() {
size(600, 600);
}
void draw() {
background(255,0,0);
positionX = mouseX;
positionY = mouseY;
if(keyPressed) {
if(key == 'a') {
positionY = positionY + 100;
}
if(key == 'z') {
positionY = positionY - 100;
}
}
rect(positionX, positionY, 20, 50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment