From a7086fc3e8641c68a6ee1149fc25580fac8ecdeb Mon Sep 17 00:00:00 2001 From: ramapcsx2 Date: Sun, 30 Nov 2014 15:54:37 +0100 Subject: [PATCH] Fixed enemies spawning out of game frame boundary --- src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java | 3 +-- src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java | 1 - src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java | 1 - src/de/teamteamteam/spacescooter/level/Level.java | 2 +- 4 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java index 7a54c65..b2871a7 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java @@ -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(); diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java index 8a6f5fa..1836b3b 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java @@ -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(); } diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java index ed48097..38c5a64 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java @@ -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 diff --git a/src/de/teamteamteam/spacescooter/level/Level.java b/src/de/teamteamteam/spacescooter/level/Level.java index 89494c6..5695688 100644 --- a/src/de/teamteamteam/spacescooter/level/Level.java +++ b/src/de/teamteamteam/spacescooter/level/Level.java @@ -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