From 48e3ac275cc368448c4931543a745a1199ee4589 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 4 Nov 2014 20:51:34 +0100 Subject: [PATCH 1/4] =?UTF-8?q?Da=20hab=20ich=20doch=20glatt=20das=20super?= =?UTF-8?q?.update()=20=C3=BCbersehen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/de/teamteamteam/spacescooter/entity/Player.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/de/teamteamteam/spacescooter/entity/Player.java b/src/de/teamteamteam/spacescooter/entity/Player.java index c80ccbc..49ea7bb 100644 --- a/src/de/teamteamteam/spacescooter/entity/Player.java +++ b/src/de/teamteamteam/spacescooter/entity/Player.java @@ -30,7 +30,6 @@ public class Player extends ShootingEntity implements KeyboardListener { } public void update() { - super.update(); if(this.canMove) { super.update(); int off = 3; From 4017d369b1fb0bdbc12f4e4bcbdcd450093c1b38 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 4 Nov 2014 21:06:36 +0100 Subject: [PATCH 2/4] Make sure Explosions cleanup after themselves. Apparrently, == 0 was not enough. --- .../teamteamteam/spacescooter/entity/explosion/Explosion.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/de/teamteamteam/spacescooter/entity/explosion/Explosion.java b/src/de/teamteamteam/spacescooter/entity/explosion/Explosion.java index 7fd1a4e..12ea650 100644 --- a/src/de/teamteamteam/spacescooter/entity/explosion/Explosion.java +++ b/src/de/teamteamteam/spacescooter/entity/explosion/Explosion.java @@ -58,7 +58,7 @@ public class Explosion extends Entity { */ public void update() { this.timeToLive--; - if(this.timeToLive == 0) this.remove(); + if(this.timeToLive <= 0) this.remove(); if(this.count > 0 && this.timeToLive % this.count == 0) { new Explosion(this.getX() + (int) (this.width * this.random.nextDouble()), this.getY() + (int) (this.height * this.random.nextDouble())); this.count--; From 0a695432a06c862136fb2038053d1c6ca7f12524 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 4 Nov 2014 21:31:47 +0100 Subject: [PATCH 3/4] Bugfix: GamePausedScreen did not correctly replace the GameScreen when going to MainMenu. --- src/de/teamteamteam/spacescooter/control/Keyboard.java | 8 +++++++- .../spacescooter/screen/GamePausedScreen.java | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/de/teamteamteam/spacescooter/control/Keyboard.java b/src/de/teamteamteam/spacescooter/control/Keyboard.java index 145d15c..cb0d5b4 100644 --- a/src/de/teamteamteam/spacescooter/control/Keyboard.java +++ b/src/de/teamteamteam/spacescooter/control/Keyboard.java @@ -70,7 +70,13 @@ public class Keyboard implements KeyListener { Keyboard.listener.remove(listener); } - + /** + * Make sure we only iterate over copies due to possible concurrent modification. + * This method returns a copy of the listener list. + */ + public ArrayList getListener() { + return new ArrayList(Keyboard.listener); + } /** * KeyListener method. * Registers the pressed key and passes the event on to registered listeners. diff --git a/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java b/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java index de1a889..1cf3100 100644 --- a/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/GamePausedScreen.java @@ -91,7 +91,8 @@ public class GamePausedScreen extends Screen { this.parent.setOverlay(null); break; case 1: - this.parent.setOverlay(new MainMenuScreen(this.parent)); + //Replace our parents (the game) parent (the SuperScreen) overlay. + this.parent.parent.setOverlay(new MainMenuScreen(this.parent.parent)); break; } } From b1e72da839774febe05d87b7fda02987f65e3731 Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 4 Nov 2014 23:28:57 +0100 Subject: [PATCH 4/4] Cleanup unneccessary ArrayList in class Background. --- .../spacescooter/background/Background.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/de/teamteamteam/spacescooter/background/Background.java b/src/de/teamteamteam/spacescooter/background/Background.java index 5407c49..cf957d2 100644 --- a/src/de/teamteamteam/spacescooter/background/Background.java +++ b/src/de/teamteamteam/spacescooter/background/Background.java @@ -1,23 +1,11 @@ package de.teamteamteam.spacescooter.background; -import java.util.ArrayList; - import de.teamteamteam.spacescooter.entity.Entity; public abstract class Background extends Entity { - public static ArrayList backgrounds = null; - - /** - * We need to initialize the ArrayList, so the EntityUpdateThread won't beat us. - */ - static { - Background.backgrounds = new ArrayList(); - } - public Background(int x, int y) { super(x, y); - Background.backgrounds.add(this); } }