From 1d887cad5c91785ce05f4cde97dc2cb6e57d4aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Fri, 9 Apr 2021 16:56:29 +0200 Subject: [PATCH] fix: typo, I'm stupid --- core/src/sagittarius/model/Arrow.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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;