Actually have the entity take care of adding it to the current screen. Whoopsie.
This commit is contained in:
parent
e2c34366e3
commit
e87ec69e97
|
@ -24,6 +24,7 @@ public abstract class Entity implements Updateable, Paintable {
|
|||
public Entity(int x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
Screen.currentScreen.addEntity(this);
|
||||
}
|
||||
|
||||
public int getX() {
|
||||
|
|
|
@ -28,11 +28,10 @@ public class GameOverScreen extends Screen {
|
|||
public GameOverScreen(Screen parent) {
|
||||
super(parent);
|
||||
this.img = Loader.getBufferedImageByFilename("images/pausebackground.png");
|
||||
this.entities.add(new Button(GameConfig.windowWidth/2-125, 300));
|
||||
this.entities.add(new Button(GameConfig.windowWidth/2-125, 400));
|
||||
new Button(GameConfig.windowWidth/2-125, 300);
|
||||
new Button(GameConfig.windowWidth/2-125, 400);
|
||||
player = new Player(GameConfig.windowWidth/2-170, 309);
|
||||
player.setCanMove(false);
|
||||
this.entities.add(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,11 +28,10 @@ public class GamePausedScreen extends Screen {
|
|||
public GamePausedScreen(Screen parent) {
|
||||
super(parent);
|
||||
this.img = Loader.getBufferedImageByFilename("images/pausebackground.png");
|
||||
this.entities.add(new Button(GameConfig.windowWidth/2-125, 300));
|
||||
this.entities.add(new Button(GameConfig.windowWidth/2-125, 400));
|
||||
new Button(GameConfig.windowWidth/2-125, 300);
|
||||
new Button(GameConfig.windowWidth/2-125, 400);
|
||||
player = new Player(GameConfig.windowWidth/2-170, 309);
|
||||
player.setCanMove(false);
|
||||
this.entities.add(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,12 +26,12 @@ public class GameScreen extends Screen {
|
|||
points.add(new Point(300,300));
|
||||
points.add(new Point(600,100));
|
||||
points.add(new Point(0,500));
|
||||
this.entities.add(new StarBackground(0, 0));
|
||||
this.entities.add(new Player(200, 300));
|
||||
this.entities.add(new HealthBar(10, 10));
|
||||
this.entities.add(new EnemyFour(800, 400, points));
|
||||
this.entities.add(new EnemyThree(650, 300));
|
||||
this.entities.add(new EnemyThree(450, 100));
|
||||
new StarBackground(0, 0);
|
||||
new Player(200, 300);
|
||||
new HealthBar(10, 10);
|
||||
new EnemyFour(800, 400, points);
|
||||
new EnemyThree(650, 300);
|
||||
new EnemyThree(450, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,15 +27,14 @@ public class MainMenuScreen extends Screen {
|
|||
|
||||
public MainMenuScreen(Screen parent) {
|
||||
super(parent);
|
||||
this.entities.add(new StarBackground(0, 0));
|
||||
this.entities.add(new Button(GameConfig.windowWidth/2-125, 200));
|
||||
this.entities.add(new Button(GameConfig.windowWidth/2-125, 275));
|
||||
this.entities.add(new Button(GameConfig.windowWidth/2-125, 350));
|
||||
this.entities.add(new Button(GameConfig.windowWidth/2-125, 425));
|
||||
this.entities.add(new Button(GameConfig.windowWidth/2-125, 500));
|
||||
new StarBackground(0, 0);
|
||||
new Button(GameConfig.windowWidth/2-125, 200);
|
||||
new Button(GameConfig.windowWidth/2-125, 275);
|
||||
new Button(GameConfig.windowWidth/2-125, 350);
|
||||
new Button(GameConfig.windowWidth/2-125, 425);
|
||||
new Button(GameConfig.windowWidth/2-125, 500);
|
||||
player = new Player(GameConfig.windowWidth/2-170, 209);
|
||||
player.setCanMove(false);
|
||||
this.entities.add(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue