diff --git a/src/Acceleration.java b/src/Acceleration.java index 3bccc68..e44caaa 100644 --- a/src/Acceleration.java +++ b/src/Acceleration.java @@ -2,24 +2,31 @@ public class Acceleration { private double mass; - private Map.Entry force; + private Vector2 force; private Velocity velocity; private Onground onground; - private Map.Entry acceleration; + private Vector2 acceleration; + public void updateMass(double mass) { this.mass = mass; - acceleration = (this.onground.getOnground() ? new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0) : new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass))); + acceleration = (this.onground.getOnground() ? new AbstractMap.SimpleEntry<>((force.getKey() / mass), 0.0) + : new Vector2((force.getX() / mass), (force.getY() / mass))); velocity.updateAcceleration(acceleration); } - public void updateForce(Map.Entry force) { + + public void updateForce(Vector2 force) { this.force = force; - acceleration = (this.onground.getOnground() ? new AbstractMap.SimpleEntry<>((force.getKey()/mass), 0.0) : new AbstractMap.SimpleEntry<>((force.getKey()/mass), (force.getValue()/mass))); + acceleration = (this.onground.getOnground() ? new Vector2((force.getX() / mass), 0.0) + : new Vector2((force.getX() / mass), (force.getY() / mass))); velocity.updateAcceleration(acceleration); } + public Acceleration(Velocity velocity, Onground onground) { + this.velocity = velocity; this.onground = onground; } - public Map.Entry getAcceleration() { + + public Vector2 getAcceleration() { return acceleration; } } \ No newline at end of file