-
jez04 authored9e34e065
Boat.java 800 B
package lab;
import javafx.geometry.Point2D;
import javafx.geometry.Rectangle2D;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.image.Image;
public class Boat {
private Scene scene;
private Point2D position;
private Image image;
public Boat(Scene scene, Point2D position) {
this.scene = scene;
this.position = position;
image = new Image(Boat.class.getResourceAsStream("ship-boat.gif"));
}
public void draw(GraphicsContext gc) {
gc.drawImage(image, position.getX(), position.getY());
gc.strokeRect(position.getX(), position.getY(), image.getWidth(), image.getHeight());
}
public void simulate(double deltaTime) {
}
public Rectangle2D getBoundingBox() {
return new Rectangle2D(position.getX(), position.getY(), image.getWidth(), image.getHeight());
}
}