fire bijwerken
This commit is contained in:
@@ -7,6 +7,7 @@ import worms.util.IllegalNameException;
|
||||
|
||||
import static java.lang.Math.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
@@ -1217,6 +1218,16 @@ public class Worm extends GameObject {
|
||||
|
||||
//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) {
|
||||
if (this.getDistance(project) <= 0) {
|
||||
project.hit(this);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int random = ThreadLocalRandom.current().nextInt(2);
|
||||
|
||||
|
Reference in New Issue
Block a user