diff --git a/OGP1718-Worms/src/worms/model/Projectile.java b/OGP1718-Worms/src/worms/model/Projectile.java index 84e5360..e06da66 100644 --- a/OGP1718-Worms/src/worms/model/Projectile.java +++ b/OGP1718-Worms/src/worms/model/Projectile.java @@ -137,7 +137,7 @@ public abstract class Projectile extends GameObject implements IJumpable { this.location.getY() + v * time * sin(a) - (G * time * time) / 2.0); if (newLoc.getX() - radius < 0 || newLoc.getY() - radius < 0 || newLoc.getX() + radius > world.getWidth() || - newLoc.getY() + radius > world.getHeight() || !world.isPassable(newLoc, radius) || + newLoc.getY() + radius > world.getHeight() || !world.isPassable(newLoc) || worms.stream().anyMatch(w -> w.getDistance(newLoc, this.radius) < 0)) { return time; } diff --git a/OGP1718-Worms/src/worms/model/World.java b/OGP1718-Worms/src/worms/model/World.java index 1056b52..a67bb0c 100644 --- a/OGP1718-Worms/src/worms/model/World.java +++ b/OGP1718-Worms/src/worms/model/World.java @@ -296,6 +296,7 @@ public class World { */ public boolean isPassable(double[] center, double radius) { + for (double i = 0; i < 2 * Math.PI; i += Math.PI / 180) { double lenX = center[0] + radius * Math.cos(i); double lenY = center[1] + radius * Math.sin(i);