-
Notifications
You must be signed in to change notification settings - Fork 4
/
Zone.pde
executable file
·52 lines (42 loc) · 1.02 KB
/
Zone.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
class Zone extends AnimSprite {
boolean playerHit = false;
boolean trackerHit = false;
String name = "";
boolean showInGame = true;
Zone(String _name, int _fps){
super(_name, _fps);
init();
}
Zone(String _name, int _fps, int _tdx, int _tdy, int _etx, int _ety){
super(_name, _fps, _tdx, _tdy, _etx, _ety);
init();
}
Zone(PImage[] _name, int _fps){
super(_name, _fps);
init();
}
void update(){
super.update();
//this checks if the player--that is, the animated graphic--is hitting a zone
if(hitDetect(player.p.x,player.p.y,player.w,player.h,p.x,p.y,w,h)){
playerHit=true;
println("Player has hit " + name + "!");
}else{
playerHit = false;
}
//this checks if the real person is hitting a zone
if(hitDetect(blobScaled.x,blobScaled.y,10,10,p.x,p.y,w,h)){
trackerHit=true;
//println("Tracker has hit " + name + "!");
}else{
trackerHit = false;
}
}
void draw(){
super.draw();
}
void run(){
update();
if(showInGame) draw();
}
}