Class EasterEggRace

java.lang.Object
rea.gameplay.games.EasterEggRace
All Implemented Interfaces:
Gameplay

public class EasterEggRace extends Object implements Gameplay
A simple game where the player has to collect all the Easter eggs in the lawn. * @author José Paulo Leal jpleal@fc.up.pt
  • Field Details

    • BACKGROUND_WIDTH

      static final int BACKGROUND_WIDTH
      The background width
      See Also:
    • BACKGROUND_HEIGHT

      static final int BACKGROUND_HEIGHT
      The background height
      See Also:
    • LAWN_VISUAL

      static final Visual LAWN_VISUAL
      The visual representation of the lawn used as a background
    • EGG_WIDTH

      static final int EGG_WIDTH
      The width of an Easter egg
      See Also:
    • EGG_HEIGHT

      static final int EGG_HEIGHT
      The height of an Easter egg
      See Also:
    • EGG_VISUAL

      static final Visual[] EGG_VISUAL
      The visual representation of some Easter eggs
  • Constructor Details

    • EasterEggRace

      public EasterEggRace()
      Create a new instance of the game
  • Method Details

    • getName

      public String getName()
      Description copied from interface: Gameplay
      The name of the game as a short string.
      Specified by:
      getName in interface Gameplay
      Returns:
      name of the game
    • getDescription

      public String getDescription()
      Description copied from interface: Gameplay
      A long description of the game.
      Specified by:
      getDescription in interface Gameplay
      Returns:
      description of the game
    • makeGameMap

      public GameMap makeGameMap()
      Description copied from interface: Gameplay
      Produce a map for a game instance. A map is a collection of interconnected places. This method returns the place where the game starts. When players enter the game they will be in this place The place can (and should) be connected to other places. Each invocation of this method must return a new instance, although with a similar structure.
      Specified by:
      makeGameMap in interface Gameplay
      Returns:
      the place where the game starts
    • getAvatars

      public Set<Avatar> getAvatars()
      The avatars available for this game: cartoon avatars.
      Specified by:
      getAvatars in interface Gameplay
      Returns:
      set of cartoon avatars
      Implementation Note:
      The avatars are the enum constants of the CartoonAvatar class
    • getMaxPlayers

      public int getMaxPlayers()
      Only a single player
      Specified by:
      getMaxPlayers in interface Gameplay
      Returns:
      1
    • getMinPlayers

      public int getMinPlayers()
      At least 1 player is required
      Specified by:
      getMinPlayers in interface Gameplay
      Returns:
      1
    • gamedEnded

      public boolean gamedEnded(GameMap gameMap)
      Game ends when there are no more eggs to collect
      Specified by:
      gamedEnded in interface Gameplay
      Parameters:
      gameMap - for this game instance
      Returns:
      true if the game has ended, false otherwise