start physics

This commit is contained in:
nora 2020-12-11 23:04:08 +01:00
parent 35c47c50b8
commit 843d30eb47
9 changed files with 61 additions and 2 deletions

View file

@ -1,18 +1,26 @@
package objects.ships;
import core.Master;
import core.Vector2D;
import objects.GameObject;
import java.awt.*;
public class Submarine extends GameObject {
public Submarine(Vector2D position, Vector2D size) {
super(position, size);
}
@Override
public void draw(Graphics2D g2d, int w, Master master) {
g2d.setPaint(Color.BLUE);
g2d.fillOval((int) (position.x - size.x / 2), (int) (position.y - size.y / 2), (int) size.x, (int) size.y);
}
@Override
public void update(Master master) {
Point mouse = master.getMouseLocation();
moveTo(new Vector2D(mouse.x, mouse.y));
}
}