mirror of
https://github.com/Noratrieb/Java2DGame.git
synced 2026-01-14 22:15:01 +01:00
start physics
This commit is contained in:
parent
35c47c50b8
commit
843d30eb47
9 changed files with 61 additions and 2 deletions
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue