mirror of
https://github.com/Noratrieb/Java2DGame.git
synced 2026-01-14 14:05:01 +01:00
31 lines
661 B
Java
31 lines
661 B
Java
package objects.ships;
|
|
|
|
import core.math.Vector2D;
|
|
import core.physics.hitboxes.RectHitBox;
|
|
import objects.core.CollGameObject;
|
|
import objects.core.GameObject;
|
|
|
|
import java.awt.*;
|
|
|
|
/**
|
|
* A shell fired by a cannon
|
|
*/
|
|
public class Shell extends GameObject {
|
|
|
|
|
|
public Shell(Vector2D position, Vector2D size, Vector2D velocity) {
|
|
super(position, size/*, new RectHitBox(position, size)*/);
|
|
this.velocity = velocity;
|
|
this.mainColor = Color.ORANGE;
|
|
}
|
|
|
|
@Override
|
|
public void draw(Graphics2D g2d) {
|
|
fillOval(g2d);
|
|
}
|
|
|
|
@Override
|
|
public void update() {
|
|
moveTo(Vector2D.add(position, velocity));
|
|
}
|
|
}
|