-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlayer.pde
46 lines (38 loc) · 1.11 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
// The player is the character played by the user and is how the user
// interfaces with the game world
public class Player extends Staff {
// C
public Player (float x, float y) {
super(x, y);
this.staffImage = HERO_DOWN_IDLE;
}
public void setFacing(Facing direction) {
if(direction == this.currentFacing)
return;
this.currentFacing = direction;
switch (direction) {
case UP:
this.staffImage = HERO_UP_IDLE;
break;
case DOWN:
this.staffImage = HERO_DOWN_IDLE;
break;
case LEFT:
this.staffImage = HERO_LEFT_IDLE;
break;
case RIGHT:
this.staffImage = HERO_RIGHT_IDLE;
break;
}
}
@Override
public void pickupItem() {
this.staffImage = HERO_PICKUP;
super.pickupItem();
}
@Override
public void useItem(int index) {
this.staffImage = HERO_USEITEM;
super.useItem(index);
}
}