-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCharacter.java
273 lines (203 loc) · 5.07 KB
/
Character.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
abstract public class Character implements Comparable<Character>{
private int health;
private int attackDamage;
private int exp;
private int moveSpeed;
protected int xPosition;
protected int yPosition;
private int hitBoxWidth;
private int hitBoxLength;
private int hitBoxX;
private int hitBoxY;
private Rectangle hitBox;
private int hurtBoxWidth;
private int hurtBoxLength;
private int rightHurtBoxX;
private int leftHurtBoxX;
private int hurtBoxY;
private Rectangle hurtBox;
protected BufferedImage[] sprites;
protected int spriteRowNum;
protected int spriteColumnNum;
protected int spriteWidth;
protected int spriteLength;
private boolean facingForward;
private boolean moving;
private boolean attacking;
private int timesMoved = 0;
private int attackAnimationCounter;//added
Character(){
}
abstract void basicAttack();
abstract void loadSprites();
public int getHealth() {
return health;
}
public void setHealth(int health) {
this.health = health;
}
public int getAttackDamage() {
return attackDamage;
}
public void setAttackDamage(int attackDamage) {
this.attackDamage = attackDamage;
}
public int getMoveSpeed() {
return moveSpeed;
}
public void setMoveSpeed(int moveSpeed) {
this.moveSpeed = moveSpeed;
}
public int getxPosition() {
return xPosition;
}
public void setxPosition(int xPosition) {
//System.out.println("original");
this.xPosition = xPosition;
}
public int getyPosition() {
return yPosition;
}
public void setyPosition(int yPostition) {
//System.out.println("original");
this.yPosition = yPostition;
}
public int getHitBoxWidth() {
return hitBoxWidth;
}
public void setHitBoxWidth(int hitBoxWidth) {
this.hitBoxWidth = hitBoxWidth;
}
public int getHitBoxLength() {
return hitBoxLength;
}
public void setHitBoxLength(int hitBoxLength) {
this.hitBoxLength = hitBoxLength;
}
public BufferedImage[] getSprites() {
return sprites;
}
public void setSprites(BufferedImage[] sprites) {
this.sprites = sprites;
}
public int getSpriteRowNum() {
return spriteRowNum;
}
public void setSpriteRowNum(int spriteRowNum) {
this.spriteRowNum = spriteRowNum;
}
public int getSpriteColumnNum() {
return spriteColumnNum;
}
public void setSpriteColumnNum(int spriteColumnNum) {
this.spriteColumnNum = spriteColumnNum;
}
public int getSpriteWidth() {
return spriteWidth;
}
public void setSpriteWidth(int spriteWidth) {
this.spriteWidth = spriteWidth;
}
public int getSpriteLength() {
return spriteLength;
}
public void setSpriteLength(int spriteLength) {
this.spriteLength = spriteLength;
}
public boolean isFacingForward() {
return facingForward;
}
public void setFacingForward(boolean facingForward) {
this.facingForward = facingForward;
}
public boolean isMoving() {
return moving;
}
public void setMoving(boolean moving) {
this.moving = moving;
}
public boolean isAttacking() {
return attacking;
}
public void setAttacking(boolean attacking) {
this.attacking = attacking;
}
public int getTimesMoved() {
return timesMoved;
}
public void setTimesMoved(int timesMoved) {
this.timesMoved = timesMoved;
}
public int getHitBoxX() {
return hitBoxX;
}
public void setHitBoxX(int hitBoxX) {
this.hitBoxX = hitBoxX;
}
public int getHitBoxY() {
return hitBoxY;
}
public void setHitBoxY(int hitBoxY) {
this.hitBoxY = hitBoxY;
}
public Rectangle getHitBox() {
return hitBox;
}
public void setHitBox(Rectangle hitBox) {
this.hitBox = hitBox;
}
public int getHurtBoxWidth() {
return hurtBoxWidth;
}
public void setHurtBoxWidth(int hurtBoxWidth) {
this.hurtBoxWidth = hurtBoxWidth;
}
public int getHurtBoxLength() {
return hurtBoxLength;
}
public void setHurtBoxLength(int hurtBoxLength) {
this.hurtBoxLength = hurtBoxLength;
}
public int getRightHurtBoxX() {
return rightHurtBoxX;
}
public void setRightHurtBoxX(int rightHurtBoxX) {
this.rightHurtBoxX = rightHurtBoxX;
}
public int getLeftHurtBoxX() {
return leftHurtBoxX;
}
public void setLeftHurtBoxX(int leftHurtBoxX) {
this.leftHurtBoxX = leftHurtBoxX;
}
public int getHurtBoxY() {
return hurtBoxY;
}
public void setHurtBoxY(int hurtBoxY) {
this.hurtBoxY = hurtBoxY;
}
public Rectangle getHurtBox() {
return hurtBox;
}
public void setHurtBox(Rectangle hurtBox) {
this.hurtBox = hurtBox;
}
public int getAttackAnimationCounter() {
return attackAnimationCounter;
}
public void setAttackAnimationCounter(int attackAnimationCounter) {
this.attackAnimationCounter = attackAnimationCounter;
}
public int getExp() {
return exp;
}
public void setExp(int exp) {
this.exp = exp;
}
public int compareTo(Character c) {
int compareItem = c.getyPosition();
return this.yPosition - compareItem;
}
}