small refactoring

This commit is contained in:
2018-05-23 21:51:14 +02:00
parent 98de279626
commit b0b94ab5d6
2 changed files with 2 additions and 1 deletions

View File

@@ -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;
}

View File

@@ -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);