Created
November 23, 2013 01:37
-
-
Save clavis-magna/7609688 to your computer and use it in GitHub Desktop.
move with keys
This file contains 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
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