fixes
This commit is contained in:
@@ -3,9 +3,6 @@ package worms.model;
|
||||
import worms.util.Coordinate;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.omg.PortableServer.ServantActivatorOperations;
|
||||
|
||||
public class World {
|
||||
|
||||
@@ -191,7 +188,7 @@ public class World {
|
||||
double length = lengthX;
|
||||
if (lengthX > lengthY) length = lengthY;
|
||||
|
||||
return isPassable(center, radius) && !isPassable(center, radius + maxDistance + 0.001);
|
||||
return isPassable(center, radius) && !isPassable(center, radius + maxDistance + 0.00001);
|
||||
}
|
||||
|
||||
public double getLengthX() {
|
||||
|
@@ -559,7 +559,7 @@ public class Worm extends GameObject {
|
||||
double direction = getOrientation();
|
||||
double minDirection = direction - 0.7875;
|
||||
double maxDirection = direction + 0.7875;
|
||||
double maxLocDirection = maxDirection;
|
||||
double maxLocDirection = minDirection;
|
||||
Coordinate maxLoc = location;
|
||||
for (; minDirection <= maxDirection; minDirection += 0.0175) {
|
||||
Coordinate tempLoc = getFurthestLocationInDirection(minDirection, this.getRadius());
|
||||
@@ -1006,44 +1006,44 @@ public class Worm extends GameObject {
|
||||
|
||||
World world = getWorld();
|
||||
Coordinate location = getLocation();
|
||||
if (!world.isPassable(location, radius)) {
|
||||
if (!world.isAdjacent(location, radius)) {
|
||||
Coordinate newLoc = Coordinate.create(location.getX() + changeRadius, location.getY());
|
||||
if (world.isPassable(newLoc, radius)) {
|
||||
if (world.isAdjacent(newLoc, radius)) {
|
||||
setLocation(newLoc);
|
||||
return;
|
||||
}
|
||||
newLoc = Coordinate.create(location.getX() - changeRadius, location.getY());
|
||||
if (world.isPassable(newLoc, radius)) {
|
||||
if (world.isAdjacent(newLoc, radius)) {
|
||||
setLocation(newLoc);
|
||||
return;
|
||||
}
|
||||
newLoc = Coordinate.create(location.getX(), location.getY() - changeRadius);
|
||||
if (world.isPassable(newLoc, radius)) {
|
||||
if (world.isAdjacent(newLoc, radius)) {
|
||||
setLocation(newLoc);
|
||||
return;
|
||||
}
|
||||
newLoc = Coordinate.create(location.getX(), location.getY() + changeRadius);
|
||||
if (world.isPassable(newLoc, radius)) {
|
||||
if (world.isAdjacent(newLoc, radius)) {
|
||||
setLocation(newLoc);
|
||||
return;
|
||||
}
|
||||
newLoc = Coordinate.create(location.getX() - changeRadius, location.getY() - changeRadius);
|
||||
if (world.isPassable(newLoc, radius)) {
|
||||
if (world.isAdjacent(newLoc, radius)) {
|
||||
setLocation(newLoc);
|
||||
return;
|
||||
}
|
||||
newLoc = Coordinate.create(location.getX() + changeRadius, location.getY() + changeRadius);
|
||||
if (world.isPassable(newLoc, radius)) {
|
||||
if (world.isAdjacent(newLoc, radius)) {
|
||||
setLocation(newLoc);
|
||||
return;
|
||||
}
|
||||
newLoc = Coordinate.create(location.getX() + changeRadius, location.getY() - changeRadius);
|
||||
if (world.isPassable(newLoc, radius)) {
|
||||
if (world.isAdjacent(newLoc, radius)) {
|
||||
setLocation(newLoc);
|
||||
return;
|
||||
}
|
||||
newLoc = Coordinate.create(location.getX() - changeRadius, location.getY() + changeRadius);
|
||||
if (!world.isPassable(newLoc, radius)) {
|
||||
if (!world.isAdjacent(newLoc, radius)) {
|
||||
terminate();
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user