Package base
Class GameLoop
java.lang.Object
base.GameLoop
- Direct Known Subclasses:
MultiLevelGame
Main class starting any game, contains main(). Apart from that, this class manages all
non-logical functionalities which should be hidden from a game designer like:
- Setting up windows, panels, buttons, action callbacks, ...
- Reading keyboard inputs
- Redrawing game window if necessary
- managing the game time and calling the appropriate
GameObject
orPlayground
methods periodically, at every time step of the game.
GameObject
and Playground
classes and implement new functionality
there. To make a long story short-
Field Summary
-
Constructor Summary
ConstructorDescriptionGameLoop()
constructor which callsdefineLevels()
, which adds all levels of this game. -
Method Summary
-
Field Details
-
SIZEX
public static int SIZEXPixel width of Game GUI ( above 0) -
SIZEY
public static int SIZEYPixel height of Game GUI (above 0)
-
-
Constructor Details
-
GameLoop
public GameLoop()constructor which callsdefineLevels()
, which adds all levels of this game.
-
-
Method Details
-
runGame
loops over alllevels
and implements the game loop to update continuously the level during play time- Parameters:
args
- command line arguments forwarded (currently ignored)- Throws:
IOException
- if hitghscore.txt cannot be written.
-
main
main to start the whole application. initializes thelevels
ArrayList of Playground instances (levels) to be played with one levelSpaceInvadersLevel
in constructor ofGameLoop()
.- Parameters:
args
- Java default command line args, forwarded torunGame(String[])
- Throws:
IOException
- in case highscore.txt cannot be written.
-