-
Notifications
You must be signed in to change notification settings - Fork 4
/
Player.pde
executable file
·52 lines (44 loc) · 1.1 KB
/
Player.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 Player extends AnimSprite {
float ease = 4;
boolean dead = true;
boolean marshes = false;
Player(String _name, int _fps){
super(_name, _fps);
init();
}
Player(String _name, int _fps, int _tdx, int _tdy, int _etx, int _ety){
super(_name, _fps, _tdx, _tdy, _etx, _ety);
init();
}
Player(PImage[] _name, int _fps){
super(_name, _fps);
init();
}
void update(){
super.update();
if(trackingPlayer){
//follow the Kinect blob
if(marshes){
p.x = tween(p.x,blobScaled.x,5 * ease);
p.y = tween(p.y,blobScaled.y,5 * ease);
}else{
p.x = tween(p.x,blobScaled.x,ease);
p.y = tween(p.y,blobScaled.y,ease);
}
}else{
//go back to the start zone
p.x = tween(p.x,zone[0].p.x,ease);
p.y = tween(p.y,zone[0].p.y,ease);
}
if(blobScaled.x > 2 * width || blobScaled.x < -2 * width || blobScaled.y > 2 * height || blobScaled.y < -2 * height) dead = true;
p.x = boundary(p.x,0,float(width));
p.y = boundary(p.y,0,float(height));
}
void draw(){
super.draw();
}
void run(){
update();
draw();
}
}