-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAndrieste.java
More file actions
128 lines (107 loc) · 2.61 KB
/
Andrieste.java
File metadata and controls
128 lines (107 loc) · 2.61 KB
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
package andrieste;
import javafx.scene.shape.Rectangle;
/**
* This is the Andrieste Class. It is a wrapper class for the player. It holds the rectangle
* that is the hitbox of the character. This class just has a bunch of getters
* and setters which the AndriesteMover class uses.
*/
public class Andrieste {
private Rectangle rect;
private double xVelocity;
private double yVelocity;
/**
* This is the constructor. It sets up the graphics.
*/
public Andrieste() {
this.setUpGraphics();
}
/**
* Returns an array of andrieste's x and y coordinates
* @return double[]
*/
public double[] getState(){
double[] state = new double[2];
state[0] = this.getX();
state[1] = this.getY();
return state;
}
/**
* Updates andrieste's position by adding the x and y velocity to the coordinates
*/
public void updatePosition() {
this.setX(this.getX() + xVelocity);
this.setY(this.getY() + yVelocity);
}
/**
* Creates the rectangle that represents andrieste
*/
private void setUpGraphics() {
this.rect = new Rectangle(0, 0,Constants.ANDRIESTE_WIDTH, Constants.ANDRIESTE_HEIGHT);
}
/**
* Gets andrieste's X location
* @return double
*/
public double getX() {
return this.rect.getX();
}
/**
* Gets andrieste's Y location
* @return double
*/
public double getY() {
return this.rect.getY();
}
/**
* Sets andrieste's x location
*/
public void setX(double x) {
this.rect.setX(x);
}
/**
* Sets andrieste's y location
*/
public void setY(double y) {
this.rect.setY(y);
}
/**
* returns the width of andrieste's hitbox
* @return double
*/
public double getWidth() {
return this.rect.getWidth();
}
/**
* returns the height of andrieste's hitbox
* @return double
*/
public double getHeight() {
return this.rect.getHeight();
}
/**
* Sets andrieste's x velocity
*/
public void setXVelocity(double xVelocity) {
this.xVelocity = xVelocity;
}
/**
* Sets andrieste's y velocity
*/
public void setYVelocity(double yVelocity) {
this.yVelocity = yVelocity;
}
/**
* returns andrieste's x velocity
* @return double
*/
public double getXVelocity() {
return this.xVelocity;
}
/**
* returns andrieste's y velocity
* @return double
*/
public double getYVelocity() {
return this.yVelocity;
}
}