Add comments to screen package.
This commit is contained in:
parent
a12ef61f7b
commit
1caf4818eb
|
@ -15,6 +15,11 @@ import de.teamteamteam.spacescooter.gui.Button;
|
|||
import de.teamteamteam.spacescooter.utility.GameConfig;
|
||||
import de.teamteamteam.spacescooter.utility.Loader;
|
||||
|
||||
/**
|
||||
* This is the GameOverScreen, which is displayed once the player
|
||||
* died and the game is over.
|
||||
* It allows to start a new game or going to the MainMenuScreen.
|
||||
*/
|
||||
public class GameOverScreen extends Screen {
|
||||
|
||||
private BufferedImage img;
|
||||
|
|
|
@ -15,6 +15,11 @@ import de.teamteamteam.spacescooter.gui.Button;
|
|||
import de.teamteamteam.spacescooter.utility.GameConfig;
|
||||
import de.teamteamteam.spacescooter.utility.Loader;
|
||||
|
||||
/**
|
||||
* This GamePausedScreen shows up when the user pressed VK_ESCAPE ingame.
|
||||
* It allows to return back into the game or going back to the MainMenuScreen,
|
||||
* discarding the current GameScreen completely.
|
||||
*/
|
||||
public class GamePausedScreen extends Screen {
|
||||
|
||||
private BufferedImage img;
|
||||
|
@ -88,10 +93,11 @@ public class GamePausedScreen extends Screen {
|
|||
} else if(this.animationStatus == 2) {
|
||||
switch (this.menuPoint) {
|
||||
case 0:
|
||||
//Removes itself from the GameScreen, so the player can continue playing.
|
||||
this.parent.setOverlay(null);
|
||||
break;
|
||||
case 1:
|
||||
//Replace our parents (the game) parent (the SuperScreen) overlay.
|
||||
//Replaces its parents (the GameScreen) parent (the SuperScreen) overlay.
|
||||
this.parent.parent.setOverlay(new MainMenuScreen(this.parent.parent));
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,12 @@ import de.teamteamteam.spacescooter.entity.Player;
|
|||
import de.teamteamteam.spacescooter.entity.enemy.EnemyFour;
|
||||
import de.teamteamteam.spacescooter.entity.enemy.EnemyThree;
|
||||
|
||||
/**
|
||||
* In this GameScreen, the actual gameplay takes place.
|
||||
* All Entities are updated and painted by it.
|
||||
* Also, it offers the GamePausedScreen when the user presses VK_ESCAPE.
|
||||
* When the Player died in the game, the GameOverScreen replaces this Screen.
|
||||
*/
|
||||
public class GameScreen extends Screen {
|
||||
|
||||
private ArrayList<Point> points = new ArrayList<Point>();
|
||||
|
|
|
@ -5,6 +5,11 @@ import java.awt.Font;
|
|||
import java.awt.Graphics2D;
|
||||
import de.teamteamteam.spacescooter.utility.GameConfig;
|
||||
|
||||
/**
|
||||
* This is the LoadingScreen, which is displayed when the game is started.
|
||||
* It vanishes when all available resources have been processed by the loader,
|
||||
* showing the MainMenuScreen.
|
||||
*/
|
||||
public class LoadingScreen extends Screen {
|
||||
|
||||
private int currentProcessed;
|
||||
|
|
|
@ -15,6 +15,9 @@ import de.teamteamteam.spacescooter.entity.Player;
|
|||
import de.teamteamteam.spacescooter.gui.Button;
|
||||
import de.teamteamteam.spacescooter.utility.GameConfig;
|
||||
|
||||
/**
|
||||
* This Screen show the games main menu.
|
||||
*/
|
||||
public class MainMenuScreen extends Screen {
|
||||
|
||||
private Player player;
|
||||
|
|
|
@ -54,14 +54,23 @@ public abstract class Screen {
|
|||
*/
|
||||
protected abstract void update();
|
||||
|
||||
/**
|
||||
* Add an Entity to this Screen, so it will be updated and drawn.
|
||||
*/
|
||||
public void addEntity(Entity e) {
|
||||
this.entities.add(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an Entity from this Screen.
|
||||
*/
|
||||
public void removeEntity(Entity e) {
|
||||
this.entities.remove(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a copy of the List of the Entities this Screen takes care of.
|
||||
*/
|
||||
public List<Entity> getEntities() {
|
||||
return new LinkedList<Entity>(this.entities);
|
||||
}
|
||||
|
|
|
@ -2,17 +2,32 @@ package de.teamteamteam.spacescooter.screen;
|
|||
|
||||
import java.awt.Graphics2D;
|
||||
|
||||
/**
|
||||
* This is the SuperScreen.
|
||||
* It is the root of our Screen hierarchy and therefore exists at all times.
|
||||
* Its overlay represents things like the MainMenuScreen, the actual GameScreen,
|
||||
* and many more.
|
||||
*/
|
||||
public class SuperScreen extends Screen {
|
||||
|
||||
/**
|
||||
* Default constructor.
|
||||
*/
|
||||
public SuperScreen(Screen parent) {
|
||||
super(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Blank implementation of the paint method.
|
||||
*/
|
||||
@Override
|
||||
public void paint(Graphics2D g) {
|
||||
//nothing to paint, we're so meta meta.
|
||||
}
|
||||
|
||||
/**
|
||||
* Blank implementation of the update method.
|
||||
*/
|
||||
@Override
|
||||
public void update() {
|
||||
//dummy method
|
||||
|
|
Loading…
Reference in New Issue