Skip to content

Instantly share code, notes, and snippets.

@Jl9549
Created May 8, 2019 07:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jl9549/32eda97d8d146fb4a565c8e0dce45ef2 to your computer and use it in GitHub Desktop.
Save Jl9549/32eda97d8d146fb4a565c8e0dce45ef2 to your computer and use it in GitHub Desktop.
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