Chapter 10: Example 10-1: Catcher
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 10-1: Catcher
Catcher catcher;
void setup() {
size(400,400);
catcher = new Catcher(32);
smooth();
}
void draw() {
background(255);
catcher.setLocation(mouseX,mouseY);
catcher.display();
}
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com
// Example 10-1: Catcher
class Catcher {
float r; // radius
float x,y; // location
Catcher(float tempR) {
r = tempR;
x = 0;
y = 0;
}
void setLocation(float tempX, float tempY) {
x = tempX;
y = tempY;
}
void display() {
stroke(0);
fill(175);
ellipse(x,y,r*2,r*2);
}
}
»
No comments yet.








