mirror of
https://github.com/Noratrieb/Java2DGame.git
synced 2026-01-14 14:05:01 +01:00
despawn fix
This commit is contained in:
parent
cfbe965ec5
commit
db584c83d4
4 changed files with 1 additions and 23 deletions
|
|
@ -52,6 +52,6 @@ public class Coordinates {
|
|||
public static boolean outOfBounds(Vector2D position, Vector2D size) {
|
||||
|
||||
return (position.x + size.magnitude() < 0 || position.x - size.magnitude() > Master.SCREEN_Y_COORDINATES * Master.SCREEN_RATIO ||
|
||||
position.y + size.magnitude() < 0 || position.y - position.magnitude() > Master.SCREEN_Y_COORDINATES);
|
||||
position.y + size.magnitude() < 0 || position.y - size.magnitude() > Master.SCREEN_Y_COORDINATES);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,28 +104,6 @@ public abstract class GameObject implements Drawable {
|
|||
g2d.fillOval((int) abs.x, (int) abs.y, (int) sizeAbs.x, (int) sizeAbs.y);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method draws an oval at the current position and size with arguments
|
||||
*
|
||||
* @param g2d The Graphics2D object provided by the master
|
||||
* @param arg Arguments like "center" for the object being drawn in the center
|
||||
*/
|
||||
public void drawOval(Graphics2D g2d, String arg) {
|
||||
|
||||
Vector2D abs;
|
||||
|
||||
if(arg.contains("center")){
|
||||
abs = Coordinates.getWorldCoordinates(getCenterPosition());
|
||||
} else {
|
||||
abs = Coordinates.getWorldCoordinates(position);
|
||||
}
|
||||
|
||||
Vector2D sizeAbs = Coordinates.getWorldCoordinates(size);
|
||||
|
||||
g2d.setPaint(mainColor);
|
||||
g2d.drawOval((int) abs.x, (int) abs.y, (int) sizeAbs.x, (int) sizeAbs.y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy this {@code GameObject}
|
||||
*/
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue