destroyed things

This commit is contained in:
nora 2020-12-13 16:55:19 +01:00
parent 435de55eb1
commit 4fb5bcc543
14 changed files with 61 additions and 18 deletions

View file

@ -129,7 +129,7 @@ public class Master extends JPanel {
* @param pos The position
*/
public void debugPos(Vector2D pos) {
create(new DebugPos(pos, new Vector2D(10, 10)));
create(new DebugPos(pos, new Vector2D(2, 2)), 3);
}
/**
@ -246,6 +246,7 @@ public class Master extends JPanel {
public void destroy(GameObject gameObject) {
objects.remove(gameObject);
objectBuffer.remove(gameObject);
drawables.get(gameObject.getLayer()).remove(gameObject);
if (gameObject instanceof Collidable) {
collidables.remove(gameObject);

View file

@ -1,6 +1,8 @@
package core.math;
import java.awt.*;
/**
* A 2-dimensional Vector that can be used to store position or velocity
*/
@ -33,6 +35,15 @@ public class Vector2D {
y = 0;
}
/**
* Get a new Vector2D from a Point
* @param point The point
* @return The Vector2D
*/
public static Vector2D fromPoint(Point point) {
return new Vector2D(point.x, point.y);
}
/**
* Add another Vector to this vector, modifies this object
*