small refactoring
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user