-
Notifications
You must be signed in to change notification settings - Fork 1
/
QMControls.java
146 lines (131 loc) · 3.31 KB
/
QMControls.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/**
* @author Edgar Quillion <edgarquill@gmail.com>
* @version Version 1
* @since 1.6
*/
/**
* Controls for the bounding box with vector qualities
*/
public class QMControls extends QMBox
{
private boolean left, right, standing;
private int LEFT, RIGHT, JUMP;
public QMControls()
{
super();
this.left = false;
this.right = false;
this.standing = false;
this.LEFT = QConstants.LEFT;
this.RIGHT = QConstants.RIGHT;
this.JUMP = QConstants.JUMP;
}
/**
* Sets the boolean value signifying if the player is moving left
* @param value boolean representing movement to the left
*/
public void setLeft(boolean value)
{
this.left = value;
}
/**
* Tells if the character is moving left
* @return boolean value stating if the character is moving left
*/
public boolean getLeft()
{
return this.left;
}
/**
* Sets the boolean value signifying if character is moving right
* @param value boolean representing movement to the right
*/
public void setRight(boolean value)
{
this.right = value;
}
/**
* Tells if the character is moving right
* @return boolean value stating if the character is moving right
*/
public boolean getRight()
{
return this.right;
}
/**
* Used to specify if character is jumping or standing
* @param value boolean representation of whether character is jumping or standing
*/
public void setStanding(boolean value)
{
this.standing = value;
}
/**
* Returns value which states whether the character is standing or not
* @return boolean value which will tell if character is standing
*/
public boolean isStanding()
{
return this.standing;
}
/**
* Sets the key that would cause character to go left
* @param key value to which to set left key to
*/
public void setLeftKey(int key)
{
this.LEFT = key;
}
/**
* Tells which key is movement to left is assigned to
* @return key value which left key is assigned to
*/
public int getLeftKey()
{
return this.LEFT;
}
/**
* Sets the key that would cause character to go right
* @param key value to which to set right key to
*/
public void setRightKey(int key)
{
this.RIGHT = key;
}
/**
* Tells which key is movement to right is assigned to
* @return key value which right key is assigned to
*/
public int getRightKey()
{
return this.RIGHT;
}
/**
* Sets the key that would cause character to jump
* @param key value to which to set jump key to
*/
public void setJumpKey(int key)
{
this.JUMP = key;
}
/**
* Tells which key jump is assigned to
* @return key value which jump key is assigned to
*/
public int getJumpKey()
{
return this.JUMP;
}
/**
* Sets all the keys at once
* @param left what to set left key to
* @param right what to set right key to
* @param jump what to set jump key to
*/
public void setKeys(int left, int right, int jump)
{
this.LEFT = left;
this.RIGHT = right;
this.JUMP = jump;
}
}