mirror of
https://github.com/Noratrieb/Java2DGame.git
synced 2026-01-15 22:45:00 +01:00
"fixed" sub
This commit is contained in:
parent
87ca37c9ca
commit
3566916125
6 changed files with 43 additions and 5 deletions
|
|
@ -76,7 +76,7 @@ public class Master extends JPanel {
|
|||
create(bs);
|
||||
create(battleShip);
|
||||
|
||||
create(new Submarine(new Vector2D(), new Vector2D(20, 20)));
|
||||
create(new Submarine(new Vector2D(), new Vector2D(5, 5)));
|
||||
create(new Wall(20, 80, 50, 2));
|
||||
}
|
||||
|
||||
|
|
@ -173,8 +173,14 @@ public class Master extends JPanel {
|
|||
|
||||
for (Collidable c : collidables) {
|
||||
double distance = Vector2D.distance(c.getCenterPos(), col.getCenterPos());
|
||||
if (!(distance > c.getSize().magnitude() && distance > col.getSize().magnitude())) {
|
||||
|
||||
if (c != col /*&& !(distance > c.getSize().magnitude() && distance > col.getSize().magnitude())*/) {
|
||||
|
||||
System.out.println("\n\nCOLL POSSIBLE");
|
||||
System.out.println("This: " + c.getHitbox() + "\n\nother: " + col.getHitbox());
|
||||
|
||||
if (c.collidesWith(col)) {
|
||||
System.err.println("COLL");
|
||||
collides = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
package core.physics;
|
||||
|
||||
import core.Drawable;
|
||||
import core.math.Vector2D;
|
||||
import objects.GameObject;
|
||||
|
||||
public abstract class Hitbox implements Drawable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue