Class Coin

All Implemented Interfaces:
Collidable
Direct Known Subclasses:
DefaultCoin

@Group public abstract class Coin extends Pickup
This class defines a simple Pickup; a Coin which will give the player points.
  • Field Details

    • SIN

      protected static double SIN
      The global SIN value for coins.
  • Constructor Details

    • Coin

      protected Coin()
      Prototype Constructor.
    • Coin

      protected Coin(Vec startPos)
      Instantiate a Coin by position.
      Parameters:
      startPos - the start position
  • Method Details

    • getPrototypes

      public static final Set<? extends GameElement> getPrototypes()
      Get a set of coin prototypes.
      Returns:
      a set of prototypes
    • perform

      public void perform(GameElement collector)
      Description copied from class: Pickup
      Template method that should be overwritten in concrete Pickups to add the action that is performed upon being collected by the Player.
      Specified by:
      perform in class Pickup
      Parameters:
      collector - the GameElement which collects this Pickup
    • innerLogicLoop

      protected void innerLogicLoop()
      Description copied from class: Entity
      This method will calculate the next position of the Entity depending on the velocity.
      Overrides:
      innerLogicLoop in class Pickup
    • internalRender

      public void internalRender(GameGrid f)
      Description copied from class: GameElement

      Template method that will be called periodically after being added to a IScene. Must be as performant as possible to keep the FPS low, since it will be called in every render-loop.

      Should be overwritten in sub classes for custom visualization using the GameGrid.

      Overrides:
      internalRender in class GameElement
      Parameters:
      f - the GameGrid that represents the games field and supplies primitive drawing operations.
    • getColor

      protected abstract RGBAColor getColor()
      Get the main color of the coin.
      Returns:
      the main color
    • getDarkerColor

      protected abstract RGBAColor getDarkerColor()
      Get a darker version of the color getColor() for the edge of the coin.
      Returns:
      the darker color
    • getValue

      protected abstract int getValue()
      Get the value of the coin.
      Returns:
      the value
    • create

      public abstract Coin create(Vec startPos, String... options)
      Description copied from class: GameElement

      Stub Factory method that every GameElement must implement in order to being able to be instantiated dynamically by the level creation.

      A startPos must be supplied to position the new GameElement right.

      Also, an array of modifiers that the extending GameElement can define and use is supplied. These are used make level creation able to determine the GameElements behavior. Note: the modifiers are not checked in syntax, so it must be thoroughly checked.

      Specified by:
      create in class Pickup
      Parameters:
      startPos - the initial position of the new GameElement.
      options - optional parameters that may determine additional behavior of the GameElement.
      Returns:
      the newly created GameElement.