Newer
Older
JumpingGame / src / Position.java
import java.util.*;

public class Position {
    private Ground ground;
    private Map.Entry<Double, Double> value;

    public void updateByVelocity(Map.Entry<Double, Double> velocity) {
        Map.Entry<Double, Double> temp_l3;
        if (((this.ground.getValue() == true) && ((this.value.getValue() + (0.01 * velocity.getValue())) < 0.0))) {
            temp_l3 = new AbstractMap.SimpleEntry<>((this.value.getKey() + (0.01 * velocity.getKey())), 0.0);
        } else {
            temp_l3 = new AbstractMap.SimpleEntry<>((this.value.getKey() + (0.01 * velocity.getKey())), (this.value.getValue() + (0.01 * velocity.getValue())));
        }
        value = temp_l3;
    }

    public Position(Ground ground) {
        this.ground = ground;
    }

    public Map.Entry<Double, Double> getValue() {
        return value;
    }
}