Class AreaGame

java.lang.Object
ch.epfl.cs107.play.areagame.AreaGame
All Implemented Interfaces:
Drawable, Game, PauseMenu.Pausable, Playable, Updatable

public abstract class AreaGame extends Object implements Game, PauseMenu.Pausable
AreaGames are a concept of Game which is displayed in a (MxN) Grid which is called an Area An AreaGame has multiple Areas
  • Constructor Details

    • AreaGame

      public AreaGame()
  • Method Details

    • addArea

      public final void addArea(Area a)
      Add an Area to the AreaGame list
      Parameters:
      a - (Area): The area to add, not null
    • setCurrentArea

      protected final Area setCurrentArea(String key, boolean forceBegin)
      Setter for the current area: Select an Area in the list from its key - the area is then begin or resume depending if the area is already started or not and if it is forced
      Parameters:
      key - (String): Key of the Area to select, not null
      forceBegin - (boolean): force the key area to call begin even if it was already started
      Returns:
      (Area): after setting it, return the new current area
    • setPauseMenu

      protected final PauseMenu setPauseMenu(PauseMenu menu)
      Set the pause menu
      Parameters:
      menu - (PauseMenu) : the new pause menu, not null
      Returns:
      (PauseMenu): the new pause menu, not null
    • getWindow

      protected final Window getWindow()
      Returns:
      (Window) : the Graphic and Audio context
    • getFileSystem

      protected final FileSystem getFileSystem()
      Returns:
      (FIleSystem): the linked file system
    • getCurrentArea

      protected final Area getCurrentArea()
      Getter for the current area
      Returns:
      (Area)
    • begin

      public boolean begin(Window window, FileSystem fileSystem)
      Description copied from interface: Playable
      Initialises game state : display and controls Note: Need to be Override
      Specified by:
      begin in interface Playable
      Parameters:
      window - (Window): display context. Not null
      fileSystem - (FileSystem): given file system. Not null
      Returns:
      (boolean): whether the game was successfully started
    • update

      public void update(float deltaTime)
      Description copied from interface: Updatable
      Simulates a single time step. Note: Need to be Override
      Specified by:
      update in interface Updatable
      Parameters:
      deltaTime - elapsed time since last update, in seconds, non-negative
    • draw

      public void draw()
      Specified by:
      draw in interface Drawable
    • end

      public void end()
      Description copied from interface: Playable
      Cleans up things, called even if initialisation failed. Note: Need to be Override
      Specified by:
      end in interface Playable
    • requestPause

      public void requestPause()
      Specified by:
      requestPause in interface PauseMenu.Pausable
    • requestResume

      public void requestResume()
      Specified by:
      requestResume in interface PauseMenu.Pausable
    • isPaused

      public boolean isPaused()
      Specified by:
      isPaused in interface PauseMenu.Pausable