Created
May 8, 2019 07:39
-
-
Save Jl9549/32eda97d8d146fb4a565c8e0dce45ef2 to your computer and use it in GitHub Desktop.
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
float r,g,b; | |
int x, y; | |
void setup() | |
{ | |
size(500, 500); | |
ellipseMode(CORNER); | |
} | |
void draw() | |
{ | |
background(255, 0 ,0); | |
noStroke(); | |
fill(100,10,10); | |
ellipse(x, y, 100, 100); | |
fill(0,255,255); | |
rect(100, 150, 10 , 100); | |
color c = get(x + 100, y + 100); | |
r = red(c); | |
println(x); | |
println(y); | |
if(r == 0 ) | |
{ | |
println("test"); | |
x = x-5; | |
y =y-5 ; | |
} else if (r == 255) { | |
println("here"); | |
} | |
} | |
void keyPressed() | |
{ | |
if(key == CODED) | |
{ | |
if(keyCode == RIGHT) | |
{ | |
x = x+5; | |
} | |
else if(keyCode == LEFT) | |
{ | |
x = x-5; | |
} | |
else if(keyCode == UP) | |
{ | |
y = y-5; | |
} | |
else if(keyCode ==DOWN) | |
{ | |
y = y +5; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment