-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPirateTower.pde
More file actions
52 lines (41 loc) · 859 Bytes
/
PirateTower.pde
File metadata and controls
52 lines (41 loc) · 859 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
43
44
45
46
47
48
49
50
51
52
class Pirate {
float x, y, slopeX, slopeY, slopeConstrainX, slopeConstrainY;
float rotate = 0;
Pirate(float tx, float ty, float trotate) {
x = tx;
y = ty;
rotate = trotate;
}
void display() {
pushMatrix();
translate(x, y);
for(int i = 0; i < puffles.length; i++) {
slopeX = 0.05 * (puffles[0].getX() - x);
slopeXconstrain = constrain(slopeX, -6, 6);
slopeY = 0.05 * (puffles[0].getY() - y);
slopeYconstrain = constrain(slopeY, -6, 6);
}
rectMode(CENTER);
fill(100);
rect(x, y, 40, 40);
popMatrix();
}
float getX() {
return x;
}
float getY() {
return y;
}
float getSlopeX() {
return slopeX;
}
float getSlopeY() {
return slopeY;
}
void setX(float tx) {
x = tx;
}
void setY(float ty) {
y = ty;
}
}