import java.util.*; public class Velocity { private Pair<Double> move; private Pair<Double> acceleration; private Position position; private Onground onground; private Pair<Double> velocity; public void updateMove(Pair<Double> move) { this.move = move; Pair<Double> temp_l0; if((this.onground.getOnground()&&(move.getSecond()>=0.0))) { temp_l0 = move; } else { temp_l0 = this.velocity; } velocity = temp_l0; position.updateVelocity(velocity); } public void updateAcceleration(Pair<Double> acceleration) { this.acceleration = acceleration; Pair<Double> temp_l2; if((this.onground.getOnground()&&(this.velocity.getSecond()<0.0))) { temp_l2 = new Pair<>((this.velocity.getFirst()+(0.01*acceleration.getFirst())), 0.0); } else { temp_l2 = new Pair<>((this.velocity.getFirst()+(0.01*acceleration.getFirst())), (this.velocity.getSecond()+(0.01*acceleration.getSecond()))); } velocity = temp_l2; position.updateVelocity(velocity); } public Velocity(Position position, Onground onground) { this.onground = onground; } public Pair<Double> getVelocity() { return velocity; } }