-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDrop.pde
More file actions
42 lines (37 loc) · 802 Bytes
/
Drop.pde
File metadata and controls
42 lines (37 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
class Drop {
//location and speed
float x;
float y;
color c;
float r;
float speed;
Drop() {
this.r = 8; //drops will have same size
this.x = random(width); //x totally random
this.y = -r * 4; //start a little above window
this.speed = random(1, 5);
this.c = color(50, 100, 150);
}
//Move the raindrop down, which in terms of Processing
//means incrementing downwards
public void fall() {
this.y+=speed;
}
//motion at edges
public boolean reachedBottom() {
if (y > height +r*4) {
return true;
} else {
return false;
}
}
public void display() {
fill(50, 100, 150);
noStroke();
ellipse(x, y, r*2, r*2);
}
public void caught() {
speed = 0;
y = -1000;
}
}