Fixed enemies spawning out of game frame boundary
This commit is contained in:
parent
8e82614874
commit
a7086fc3e8
|
@ -21,7 +21,6 @@ public class EnemyBoss extends Enemy{
|
|||
this.setCollisionDamage(50);
|
||||
this.setScore(5000);
|
||||
this.willShoot = true;
|
||||
this.setPosition(GameConfig.windowWidth, Random.nextInt(GameConfig.windowHeight - this.getHeight() - 50) +50);
|
||||
new BossHealthBar(10, 44, this);
|
||||
}
|
||||
|
||||
|
@ -40,7 +39,7 @@ public class EnemyBoss extends Enemy{
|
|||
public void explode() {
|
||||
new MultiExplosion(this.getCenteredX(), this.getCenteredY());
|
||||
}
|
||||
|
||||
// ToDo: fetch all position variables from gameconfig instead of hardcoded vars
|
||||
@Override
|
||||
public void update() {
|
||||
super.update();
|
||||
|
|
|
@ -23,7 +23,6 @@ public class EnemyThree extends Enemy{
|
|||
this.setHealthPoints(15);
|
||||
this.setCollisionDamage(10);
|
||||
this.setScore(30);
|
||||
this.setPosition(GameConfig.windowWidth, Random.nextInt(GameConfig.windowHeight - this.getHeight() - 50) +50);
|
||||
this.newY = this.getY();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ public class EnemyTwo extends Enemy{
|
|||
this.setHealthPoints(5);
|
||||
this.setScore(20);
|
||||
this.setCollisionDamage(this.getHealthPoints());
|
||||
this.setPosition(GameConfig.windowWidth, Random.nextInt(GameConfig.windowHeight - this.getHeight()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -83,7 +83,7 @@ public final class Level {
|
|||
//If the rule matches the current time, spawn the configured Entity in the configured amount:
|
||||
for(int i=0; i<spawnrule[2]; i++) {
|
||||
//TODO: More beautiful positions!
|
||||
this.spawnEntityByAvailableName(Entity.availableNames.values()[spawnrule[1]], GameConfig.windowWidth - 75, Random.nextInt(GameConfig.windowHeight));
|
||||
this.spawnEntityByAvailableName(Entity.availableNames.values()[spawnrule[1]], GameConfig.windowWidth - 25, Random.nextInt(GameConfig.windowHeight -50)+50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue