diff --git a/core/src/sagittarius/model/Arrow.java b/core/src/sagittarius/model/Arrow.java index b1caf52..450b7cc 100644 --- a/core/src/sagittarius/model/Arrow.java +++ b/core/src/sagittarius/model/Arrow.java @@ -16,9 +16,9 @@ public class Arrow extends Actor { // ---------- ATTRIBUTEs ---------- - private Vector2 velocity = new Vector2(); - private Vector2 acceleration = new Vector2(); - private Vector2 force = new Vector2(); + private Vector2 velocity; + private Vector2 acceleration; + private Vector2 force; private float TTL = 20; @@ -56,10 +56,11 @@ public class Arrow extends Actor { for (Actor actor : GameScreen.planets.getChildren()) { float dx = actor.getX() - this.getX(); - float dy = actor.getX() - this.getX(); + float dy = actor.getY() - this.getY(); float len2 = dx*dx + dy*dy; - float coeff = SagittariusGame.G * ((Planet) actor).getMass() * (float) Math.pow(len2, -3/2); + + float coeff = (float) (SagittariusGame.G * ((Planet) actor).getMass() * Math.pow(len2, -3/2)); float gravityX = coeff * dx; float gravityY = coeff * dy;