-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hitbox.pde
47 lines (40 loc) · 827 Bytes
/
Hitbox.pde
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
class Hitbox {
private float x;
private float y;
private float w;
private float h;
private int[] colors;
private Game game;
public Hitbox(float x, float y, float w, float h, int[] colors, Game game) {
this.game = game;
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.colors = colors;
this.game.addHitbox(this);
}
public double getX() {
return x;
}
public double getY() {
return y;
}
public double getWidth() {
return w;
}
public double getHeight() {
return h;
}
public void draw() {
fill(colors[0], colors[1], colors[2]);
rect(x, y, w, h);
}
public void update(float x, float y, float w, float h, int[] colors) {
this.x = x;
this.y = y;
this.w = w;
this.h = h;
this.colors = colors;
}
}