Class Inanimate

java.lang.Object
rekit.logic.gameelements.GameElement
rekit.logic.gameelements.inanimate.Inanimate
All Implemented Interfaces:
Collidable
Direct Known Subclasses:
DynamicInanimate, InanimateBox, InanimateFloor, InanimateTrigger

public class Inanimate extends GameElement
This is the default implementation of an inanimate in the game.
  • Field Details

    • color

      protected RGBAColor color
      The color.
  • Constructor Details

    • Inanimate

      protected Inanimate(Vec pos, Vec size, RGBAColor color, Team team)
      Create an inanimate.
      Parameters:
      pos - the position
      size - the size
      color - the color
      team - the team
    • Inanimate

      protected Inanimate(Vec pos, Vec size, RGBAColor color)
      Create an inanimate.
      Parameters:
      pos - the position
      size - the size
      color - the color
  • Method Details

    • 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.
    • reactToCollision

      public void reactToCollision(GameElement element, Direction dir)
      Description copied from interface: Collidable

      Notification that this GameElement has been collided with from another GameElement element from the given direction dir.

      Can be overwritten for defining an optional reaction that the GameElement performs on the other GameElement and/or itself upon collision.

      Specified by:
      reactToCollision in interface Collidable
      Overrides:
      reactToCollision in class GameElement
      Parameters:
      element - the GameElement that collided with this GameElement
      dir - the Direction this GameElement has been collided from.
    • collidedWithSolid

      public void collidedWithSolid(Frame collision, Direction dir)
      Description copied from interface: Collidable
      Optional reaction to a collision that can be invoked in other GameElements reactToCollision(). Notification that this GameElement has collided with another GameElement with the CollisionFrame collision from a given direction dir. Define optional reactions that the GameElement performs on itself upon collision.
      Parameters:
      collision - the Frame of the GameElement that was collided on
      dir - the direction of this GameElement where the collision took place
    • getLives

      public int getLives()
      Description copied from interface: Collidable
      Getter for the current lifes of the GameElement.
      Returns:
      the amount of lifes of the GameElement
    • create

      public Inanimate 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.

      Overrides:
      create in class GameElement
      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.
    • getPrototype

      public static Inanimate getPrototype()
      Get the inanimate-prototype.
      Returns:
      the prototype