Merge branch 'master' of github.com:teamteamteam/SpaceScooter

This commit is contained in:
lubiana 2014-11-05 01:00:25 +01:00
commit 1f65979f41
5 changed files with 10 additions and 16 deletions

View File

@ -1,23 +1,11 @@
package de.teamteamteam.spacescooter.background; package de.teamteamteam.spacescooter.background;
import java.util.ArrayList;
import de.teamteamteam.spacescooter.entity.Entity; import de.teamteamteam.spacescooter.entity.Entity;
public abstract class Background extends Entity { public abstract class Background extends Entity {
public static ArrayList<Background> backgrounds = null;
/**
* We need to initialize the ArrayList, so the EntityUpdateThread won't beat us.
*/
static {
Background.backgrounds = new ArrayList<Background>();
}
public Background(int x, int y) { public Background(int x, int y) {
super(x, y); super(x, y);
Background.backgrounds.add(this);
} }
} }

View File

@ -70,7 +70,13 @@ public class Keyboard implements KeyListener {
Keyboard.listener.remove(listener); 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<KeyboardListener> getListener() {
return new ArrayList<KeyboardListener>(Keyboard.listener);
}
/** /**
* KeyListener method. * KeyListener method.
* Registers the pressed key and passes the event on to registered listeners. * Registers the pressed key and passes the event on to registered listeners.

View File

@ -30,7 +30,6 @@ public class Player extends ShootingEntity implements KeyboardListener {
} }
public void update() { public void update() {
super.update();
if(this.canMove) { if(this.canMove) {
super.update(); super.update();
int off = 3; int off = 3;

View File

@ -58,7 +58,7 @@ public class Explosion extends Entity {
*/ */
public void update() { public void update() {
this.timeToLive--; this.timeToLive--;
if(this.timeToLive == 0) this.remove(); if(this.timeToLive <= 0) this.remove();
if(this.count > 0 && this.timeToLive % this.count == 0) { 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())); new Explosion(this.getX() + (int) (this.width * this.random.nextDouble()), this.getY() + (int) (this.height * this.random.nextDouble()));
this.count--; this.count--;

View File

@ -91,7 +91,8 @@ public class GamePausedScreen extends Screen {
this.parent.setOverlay(null); this.parent.setOverlay(null);
break; break;
case 1: 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; break;
} }
} }