k
This commit is contained in:
parent
148c0c739f
commit
d6f8cb59c9
1 changed files with 17 additions and 11 deletions
|
|
@ -93,24 +93,30 @@ public abstract class Unit extends GameEntity{
|
|||
if(moveTo!=null) {
|
||||
Vector2i moveVect = Map.getPosByPixel(moveTo.getX(), moveTo.getY());
|
||||
Vector2i currentVect = Map.getPosByPixel(unitNode.getLocation().getX(), unitNode.getLocation().getY());
|
||||
//System.out.println("going to: "+moveVect);
|
||||
//System.out.println("from: "+currentVect);
|
||||
Vector3f currentRot = null;
|
||||
System.out.println("going to: "+moveVect);
|
||||
System.out.println("from: "+currentVect);
|
||||
Vector3f lastRotation = new Vector3f(0, 0, 0);
|
||||
|
||||
//The rotation animation is done here.
|
||||
if(moveVect.getX() < currentVect.getX()) {
|
||||
unitNode.get("Tank").setRotation(new Vector3f(0, 0, 90));
|
||||
|
||||
}
|
||||
if(moveVect.getX() > currentVect.getX()) {
|
||||
|
||||
if(moveVect.getX() > currentVect.getX()){
|
||||
unitNode.get("Tank").setRotation(new Vector3f(0, 0, -90));
|
||||
}
|
||||
if(moveVect.getY() < currentVect.getY()) {
|
||||
|
||||
if(moveVect.getY() < currentVect.getY()){
|
||||
unitNode.get("Tank").setRotation(new Vector3f(0, 0, 180));
|
||||
}
|
||||
|
||||
if(moveVect.getY() > currentVect.getY()) {
|
||||
unitNode.get("Tank").setRotation(new Vector3f(0, 0, 0));
|
||||
}
|
||||
//System.out.println(unitNode.get("Tank").getRotation());
|
||||
|
||||
|
||||
//The moving is done here.
|
||||
if(moveTo.getX() > unitNode.getLocation().getX()) {
|
||||
unitNode.getLocation().add(1.5f, 0f, 0f);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue