-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRedWall.java
85 lines (75 loc) · 2.16 KB
/
RedWall.java
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* Red Wall - kills player
*
* @author Brandon Wang
* @version May 24 2019
*/
public class RedWall implements Wall
{
private Player interactPlayer; //the Player the wall interacts with
/**
* Constructor for the RedWall class
*
* @param player the Player the wall interacts with
*/
public RedWall(Player player)
{
interactPlayer = player;
}
/**
* An interaction with the Wall when the player comes from the left
* Stops and kills player
*
* @param futureX the theoretical x position of the player on the next frame
*/
public void interactLeft(double futureX)
{
//stop player's movement
interactPlayer.setXVel(0);
interactPlayer.setYVel(0);
//kill player
interactPlayer.setAliveStatus(false);
}
/**
* An interaction with the Wall when the player comes from the right
* Stops and kills player
*
* @param futureX the theoretical x position of the player on the next frame
*/
public void interactRight(double futureX)
{
//stop player's movement
interactPlayer.setXVel(0);
interactPlayer.setYVel(0);
//kill player
interactPlayer.setAliveStatus(false);
}
/**
* An interaction with the Wall when the player comes from the top
* Stops and kills player
*
* @param futureY the theoretical y position of the player on the next frame
*/
public void interactFloor(double futureY)
{
//stop player's movement
interactPlayer.setXVel(0);
interactPlayer.setYVel(0);
//kill player
interactPlayer.setAliveStatus(false);
}
/**
* An interaction with the Wall when the player comes from the bottom
* Stops and kills player
*
* @param futureY the theoretical y position of the player on the next frame
*/
public void interactCeiling(double futureY)
{
//stop player's movement
interactPlayer.setXVel(0);
interactPlayer.setYVel(0);
//kill player
interactPlayer.setAliveStatus(false);
}
}