mirror of
https://github.com/Noratrieb/Java2DGame.git
synced 2026-01-15 22:45:00 +01:00
destroyed things
This commit is contained in:
parent
435de55eb1
commit
4fb5bcc543
14 changed files with 61 additions and 18 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue