package views; import entities.Pair; import models.IModel; import models.JumpingGameModel; public class TileRenderer implements IView { private Sprite sprite; private Pair<Double> initPositionValue; public TileRenderer(String path, Pair<Double> initPosition, double scale) { this.initPositionValue = initPosition; this.sprite = new Sprite(path); this.sprite.setScaleValue(scale); this.sprite.setPositionValue(initPosition); } public double getScaleValue() { return this.sprite.getScaleValue(); } @Override public void update(IModel model) { JumpingGameModel jumpingGameModel = (JumpingGameModel) model; Double x = this.initPositionValue.getLeft() - (jumpingGameModel.getPosition().getLeft() * 64); Double y = this.sprite.getPositionValue().getRight(); this.sprite.setPositionValue(new Pair<>(x, y)); } @Override public void display() { sprite.draw(); } @Override public void delete() { sprite.delete(); } }