Better collidable implementation

This commit is contained in:
nora 2020-12-13 16:14:08 +01:00
parent 69f784b913
commit 435de55eb1
12 changed files with 77 additions and 49 deletions

View file

@ -1,15 +1,20 @@
package objects.ships;
import core.math.Vector2D;
import objects.GameObject;
import core.physics.hitboxes.RectHitBox;
import objects.core.CollGameObject;
import java.awt.*;
public class Shell extends GameObject {
/**
* A shell fired by a cannon
*/
//TODO why tf do shells not use map coords...
public class Shell extends CollGameObject {
public Shell(Vector2D position, Vector2D size, Vector2D velocity) {
super(position, size);
super(position, size, new RectHitBox(position, size));
this.velocity = velocity;
}
@ -21,6 +26,6 @@ public class Shell extends GameObject {
@Override
public void update() {
position.add(velocity);
moveTo(Vector2D.add(position, velocity));
}
}