-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathItems.pde
59 lines (47 loc) · 856 Bytes
/
Items.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
48
49
50
51
52
53
54
55
56
57
58
59
class Items
{
float x, y, z;
int counter = 0;
int increment = 2;
boolean alive = true;
// constructor for regular items
Items(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
}
void move(float xOffset, float yOffset, float zOffset)
{
this.x += xOffset;
this.y += yOffset;
this.z += zOffset;
}
void display()
{
pushMatrix();
translate(x, y, z);
ellipse(0,0,100,100);
popMatrix();
}
void display(PImage image)
{
if(alive)
{
pushMatrix();
translate(x, y, z);
image(image, 0, 0);
popMatrix();
}
}
boolean checkHit(float hx, float hy, float hz)
{
if(alive && dist(x,y,z,hx, hy, hz) < 150)
{
alive = false;
return true;
}
else
return false;
}
}