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 worms.util.Coordinate;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class Projectile extends GameObject {
|
public abstract class Projectile extends GameObject {
|
||||||
|
|
||||||
private static final int rho = 7800;
|
private static final int rho = 7800;
|
||||||
@@ -111,7 +113,6 @@ public abstract class Projectile extends GameObject {
|
|||||||
throw new RuntimeException();
|
throw new RuntimeException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,10 +128,16 @@ public abstract class Projectile extends GameObject {
|
|||||||
double t = getJumpTime(jumpTimeStep);
|
double t = getJumpTime(jumpTimeStep);
|
||||||
double a = getOrientation();
|
double a = getOrientation();
|
||||||
Coordinate newLocation;
|
Coordinate newLocation;
|
||||||
|
|
||||||
|
|
||||||
//TODO In case the initial position of a projectile already hits impassable terrain or a worm, the projectile will
|
List<Worm> worms = getWorld().getGameObjectsByClass(Worm.class);
|
||||||
//TODO jump over a distance of 0.0 m.
|
|
||||||
|
for (Worm worm: worms) {
|
||||||
|
if (this.getDistance(worm) < 0) {
|
||||||
|
newLocation = Coordinate.create(getLocation().getX(), getLocation().getY());
|
||||||
|
setLocation(newLocation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (getWorld().isAdjacent(getLocation(),getRadius())) {
|
if (getWorld().isAdjacent(getLocation(),getRadius())) {
|
||||||
newLocation = Coordinate.create(getLocation().getX(), getLocation().getY());
|
newLocation = Coordinate.create(getLocation().getX(), getLocation().getY());
|
||||||
}
|
}
|
||||||
|
@@ -1227,9 +1227,6 @@ public class Worm extends GameObject {
|
|||||||
|
|
||||||
public Projectile fire() {
|
public Projectile fire() {
|
||||||
if (canFire()) {
|
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()) {
|
if (!getWorld().getGameObjectsByClass(Projectile.class).isEmpty()) {
|
||||||
List<Projectile> projectiles = getWorld().getGameObjectsByClass(Projectile.class);
|
List<Projectile> projectiles = getWorld().getGameObjectsByClass(Projectile.class);
|
||||||
for (Projectile project: projectiles) {
|
for (Projectile project: projectiles) {
|
||||||
|
Reference in New Issue
Block a user