Merge branch 'master' of gitlab.principis.be:OGP/worms
This commit is contained in:
@@ -4,6 +4,8 @@ import static java.lang.Math.*;
|
||||
|
||||
import worms.util.Coordinate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class Projectile extends GameObject {
|
||||
|
||||
private static final int rho = 7800;
|
||||
@@ -111,7 +113,6 @@ public abstract class Projectile extends GameObject {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
@@ -127,10 +128,16 @@ public abstract class Projectile extends GameObject {
|
||||
double t = getJumpTime(jumpTimeStep);
|
||||
double a = getOrientation();
|
||||
Coordinate newLocation;
|
||||
|
||||
|
||||
//TODO In case the initial position of a projectile already hits impassable terrain or a worm, the projectile will
|
||||
//TODO jump over a distance of 0.0 m.
|
||||
List<Worm> worms = getWorld().getGameObjectsByClass(Worm.class);
|
||||
|
||||
for (Worm worm: worms) {
|
||||
if (this.getDistance(worm) < 0) {
|
||||
newLocation = Coordinate.create(getLocation().getX(), getLocation().getY());
|
||||
setLocation(newLocation);
|
||||
}
|
||||
}
|
||||
|
||||
if (getWorld().isAdjacent(getLocation(),getRadius())) {
|
||||
newLocation = Coordinate.create(getLocation().getX(), getLocation().getY());
|
||||
}
|
||||
|
@@ -1227,9 +1227,6 @@ public class Worm extends GameObject {
|
||||
|
||||
public Projectile fire() {
|
||||
if (canFire()) {
|
||||
|
||||
//TODO location overlaps with 1 or more projectiles => firing worm is hit by one overlapping projectile
|
||||
//TODO => method returns null
|
||||
if (!getWorld().getGameObjectsByClass(Projectile.class).isEmpty()) {
|
||||
List<Projectile> projectiles = getWorld().getGameObjectsByClass(Projectile.class);
|
||||
for (Projectile project: projectiles) {
|
||||
|
Reference in New Issue
Block a user