Newer
Older
JumpingGame / src / main / java / entities / Position.java
package entities;

public class Position {
	private Gameover gameover;
	private Clear clear;
	private Onground onground;
	private Ground ground;
	private Pair<Double> value = new Pair<>(0.0,0.0);
	public void updateVelocity(Pair<Double> velocity) {
		Pair<Double> temp_if4;
		if (((this.ground.getValue()==true)&&((this.value.getRight()+(0.01*velocity.getRight()))<0.0))) {
			temp_if4 = new Pair<>((this.value.getLeft()+(0.01*velocity.getLeft())),0.0);
		} else {
			temp_if4 = new Pair<>((this.value.getLeft()+(0.01*velocity.getLeft())),(this.value.getRight()+(0.01*velocity.getRight())));
		}
		value = temp_if4;
		gameover.updatePosition(value);
		clear.updatePosition(value);
		onground.updatePosition(value);
	}
	public Position(Gameover gameover, Clear clear, Onground onground, Ground ground) {
		this.gameover = gameover;
		this.clear = clear;
		this.onground = onground;
		this.ground = ground;
	}
	public Pair<Double> getValue() {
		return value;
	}
}