diff --git a/src/de/teamteamteam/spacescooter/background/item/Items.java b/src/de/teamteamteam/spacescooter/background/item/Items.java index ea38611..7e916c2 100644 --- a/src/de/teamteamteam/spacescooter/background/item/Items.java +++ b/src/de/teamteamteam/spacescooter/background/item/Items.java @@ -35,16 +35,16 @@ public abstract class Items extends LivingEntity{ int auswahl = ItemChance.choose(); switch (auswahl) { case 0: - Screen.currentScreen.addEntity(new TestItem1(x, y)); + new TestItem1(x, y); break; case 1: - Screen.currentScreen.addEntity(new TestItem2(x, y)); + new TestItem2(x, y); break; case 2: - Screen.currentScreen.addEntity(new TestItem3(x, y)); + new TestItem3(x, y); break; case 3: - Screen.currentScreen.addEntity(new TestItem4(x, y));; + new TestItem4(x, y);; break; } } diff --git a/src/de/teamteamteam/spacescooter/entity/LivingEntity.java b/src/de/teamteamteam/spacescooter/entity/LivingEntity.java index c206e4b..91050d2 100644 --- a/src/de/teamteamteam/spacescooter/entity/LivingEntity.java +++ b/src/de/teamteamteam/spacescooter/entity/LivingEntity.java @@ -94,7 +94,7 @@ public abstract class LivingEntity extends Entity implements Collidable { } public void explode() { - Screen.currentScreen.addEntity(new Explosion(this.x, this.y)); + new Explosion(this.x, this.y); } public void setHealthPoints(int hp) { diff --git a/src/de/teamteamteam/spacescooter/entity/Player.java b/src/de/teamteamteam/spacescooter/entity/Player.java index 361714c..16de7c9 100644 --- a/src/de/teamteamteam/spacescooter/entity/Player.java +++ b/src/de/teamteamteam/spacescooter/entity/Player.java @@ -62,9 +62,9 @@ public class Player extends ShootingEntity implements KeyboardListener { */ @Override public void remove() { - super.remove(); this.keyboard.removeListener(this); this.keyboard = null; + super.remove(); } @Override diff --git a/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java b/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java index 4b31e6d..8d9cfd3 100644 --- a/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java +++ b/src/de/teamteamteam/spacescooter/entity/ShootingEntity.java @@ -1,7 +1,6 @@ package de.teamteamteam.spacescooter.entity; import de.teamteamteam.spacescooter.entity.shot.SingleBlueShot; -import de.teamteamteam.spacescooter.screen.Screen; public abstract class ShootingEntity extends LivingEntity { @@ -25,7 +24,7 @@ public abstract class ShootingEntity extends LivingEntity { protected void shoot() { if(this.currentShootDelay == 0) { - Screen.currentScreen.addEntity(new SingleBlueShot(this.x + this.shootSpawnX, this.y + this.shootSpawnY, this.shootDirection, this.shootSpeed, this.damageValue)); + new SingleBlueShot(this.x + this.shootSpawnX, this.y + this.shootSpawnY, this.shootDirection, this.shootSpeed, this.damageValue); this.currentShootDelay = this.shootDelay; } } diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java index a10d394..b6a0863 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyThree.java @@ -35,11 +35,11 @@ public class EnemyThree extends Enemy{ this.setPosition(this.getX()-1, this.getY()); if(this.getX() < 0-getWidth()){ this.remove(); - Screen.currentScreen.addEntity(new EnemyThree(0, 0)); + new EnemyThree(0, 0); } if(!this.isAlive()){ if(random.nextInt(10) < 5) Items.create(getX(), getY()); - Screen.currentScreen.addEntity(new EnemyThree(0, 0)); + new EnemyThree(0, 0); } LinkedList list = Screen.currentScreen.getEntities(); Iterator i = list.iterator(); diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java index 8ea4b6b..41a75b2 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyTwo.java @@ -2,7 +2,6 @@ package de.teamteamteam.spacescooter.entity.enemy; import java.util.Random; -import de.teamteamteam.spacescooter.screen.Screen; import de.teamteamteam.spacescooter.utility.GameConfig; public class EnemyTwo extends Enemy{ @@ -25,10 +24,10 @@ public class EnemyTwo extends Enemy{ this.setPosition(this.getX()-1, this.getY()); if(this.getX() < 0-getWidth()){ this.remove(); - Screen.currentScreen.addEntity(new EnemyTwo(0, 0)); + new EnemyTwo(0, 0); } if(!this.isAlive()){ - Screen.currentScreen.addEntity(new EnemyTwo(0, 0)); + new EnemyTwo(0, 0); } } diff --git a/src/de/teamteamteam/spacescooter/entity/explosion/Explosion.java b/src/de/teamteamteam/spacescooter/entity/explosion/Explosion.java index b467334..7fd1a4e 100644 --- a/src/de/teamteamteam/spacescooter/entity/explosion/Explosion.java +++ b/src/de/teamteamteam/spacescooter/entity/explosion/Explosion.java @@ -3,7 +3,6 @@ package de.teamteamteam.spacescooter.entity.explosion; import java.util.Random; import de.teamteamteam.spacescooter.entity.Entity; -import de.teamteamteam.spacescooter.screen.Screen; public class Explosion extends Entity { @@ -33,9 +32,9 @@ public class Explosion extends Entity { this.setPosition(x - (this.getWidth()/2), y - (this.getHeight()/2)); Random rand = new Random(); if (rand.nextInt(99) <= 70) { - Screen.currentScreen.addEntity(new ExplosionOne(x, y)); + new ExplosionOne(x, y); } else { - Screen.currentScreen.addEntity(new ExplosionTwo(x, y)); + new ExplosionTwo(x, y); } }