Projectile: fix errors

This commit is contained in:
Leen Dereu
2018-05-20 14:43:15 +02:00
parent 6313adaf4c
commit 909d972654
2 changed files with 3 additions and 5 deletions

View File

@@ -129,7 +129,6 @@ public abstract class Projectile extends GameObject {
Coordinate newLocation; Coordinate newLocation;
//TODO extra parameter if: als de worm die wil schieten tegen een andere worm staat:
//TODO In case the initial position of a projectile already hits impassable terrain or a worm, the projectile will //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. //TODO jump over a distance of 0.0 m.
if (getWorld().isAdjacent(getLocation(),getRadius())) { if (getWorld().isAdjacent(getLocation(),getRadius())) {
@@ -153,7 +152,6 @@ public abstract class Projectile extends GameObject {
wormLocation.getY() + sin(wormOrientation) * (wormRadius + radius)); wormLocation.getY() + sin(wormOrientation) * (wormRadius + radius));
} }
//TODO hit impassable terrain (adjacent, partly or complete): projectile stays at that position
public void hit(Worm... worm){ public void hit(Worm... worm){
for (Worm wormA : worm){ for (Worm wormA : worm){
//TODO bazooka: hitpoints multiplied with force? //TODO bazooka: hitpoints multiplied with force?

View File

@@ -1222,8 +1222,8 @@ public class Worm extends GameObject {
List<Projectile> projectiles = getWorld().getGameObjectsByClass(Projectile.class); List<Projectile> projectiles = getWorld().getGameObjectsByClass(Projectile.class);
for (Projectile project: projectiles) { for (Projectile project: projectiles) {
if (this.getDistance(project) <= 0) { if (this.getDistance(project) <= 0) {
project.hit(this); project.hit(this);
return null; return null;
} }
} }
} }