Newer
Older
JumpingGameOriginalSources / src / Position.java
k-fujii on 2 Dec 2021 744 bytes initial commit
import java.util.*;

public class Position {
	private Ground ground;
	private Map.Entry<Double, Double> position;
	public void updateVelocity(Map.Entry<Double, Double> velocity) {
		Map.Entry<Double, Double> temp_l4;
		if(((this.ground.getGround()==true)&&((this.position.getValue()+(0.01*velocity.getValue()))<0.0))) {
			temp_l4 = new AbstractMap.SimpleEntry<>((this.position.getKey()+(0.01*velocity.getKey())), 0.0);
		} else {
			temp_l4 = new AbstractMap.SimpleEntry<>((this.position.getKey()+(0.01*velocity.getKey())), (this.position.getValue()+(0.01*velocity.getValue())));
		}
		position = temp_l4;
	}
	public Position(Ground ground) {
		this.ground = ground;
	}
	public Map.Entry<Double, Double> getPosition() {
		return position;
	}
}