added a Entity.java class that handles position rotation and collition. collition has jet not been made.
This commit is contained in:
parent
dbee794932
commit
0044d4fff4
17 changed files with 154 additions and 55 deletions
42
src/ei/engine/math/Vector2D.java
Normal file
42
src/ei/engine/math/Vector2D.java
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
package ei.engine.math;
|
||||
|
||||
public class Vector2D {
|
||||
private double x;
|
||||
private double y;
|
||||
|
||||
public Vector2D(double x, double y){
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the X value
|
||||
*
|
||||
* @return the x value in the vector
|
||||
*/
|
||||
public double getX(){
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Y value
|
||||
*
|
||||
* @return the y value in the vector
|
||||
*/
|
||||
public double getY(){
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add to the vectro
|
||||
* @param i The amount to add
|
||||
*/
|
||||
public void add(double i){
|
||||
x += i;
|
||||
y += i;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "Vector2I["+x+","+y+"]";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue