Newer
Older
JumpingGame / src / Force.java
k-fujii on 10 Sep 2021 436 bytes ・updateメソッドとsetterを分離
import java.util.*;

public class Force {
	private Acceleration acceleration;
	private Map.Entry<Double, Double> force;

	public Force(Acceleration acceleration) {
		this.acceleration = acceleration;
	}

	public void gravity(double y) {
		this.force = new AbstractMap.SimpleEntry<>(0.0, y);
		acceleration.setForce(this.force);
		acceleration.updateAcceleration();
	}

	public Map.Entry<Double, Double> getForce() {
		return force;
	}
}