Skip to content

Instantly share code, notes, and snippets.

@clavis-magna
Created November 23, 2013 01:37
Show Gist options
  • Save clavis-magna/7609688 to your computer and use it in GitHub Desktop.
Save clavis-magna/7609688 to your computer and use it in GitHub Desktop.
move with keys
int x = 100;
int y = 100;
color circleColour = color(0,0,0);
void setup(){
size(200,200);
noStroke();
}
void draw(){
//background(140);
if(keyPressed){
if(key == 'a' || key == 'A'){
x = x -1;
}
if(key == 'd'){
x = x +1;
}
if(key == 'p'){
background(140);
}
if(key == 'g'){
circleColour = color(0,255,0);
}
if(key == 'r'){
circleColour = color(255,0,0);
}
}
fill(circleColour);
ellipse(x,y,10,10);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment