java.lang.Object
de.tum.cit.ase.maze.objects.GameElement
de.tum.cit.ase.maze.objects.still.collectable.Collectable
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
Direct Known Subclasses:
HealthCollectable, Key, TimedCollectable, Trap2, Traps

public abstract class Collectable extends GameElement
A collectable is a GameElement that can be collected by a player and then applies an effect to the Player.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     
    protected float
     
    protected float
     
    protected final box2dLight.PositionalLight
     
    protected box2dLight.RayHandler
     
    protected boolean
     
    protected com.badlogic.gdx.graphics.g2d.TextureAtlas
     
    protected com.badlogic.gdx.graphics.g2d.TextureRegion
     
    protected float
     

    Fields inherited from class de.tum.cit.ase.maze.objects.GameElement

    body, texture, world
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    Collectable(com.badlogic.gdx.math.Vector2 position, com.badlogic.gdx.physics.box2d.World world, box2dLight.RayHandler rayHandler, com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas)
     
    protected
    Collectable(com.badlogic.gdx.math.Vector2 position, com.badlogic.gdx.physics.box2d.World world, box2dLight.RayHandler rayHandler, com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas, float frameWidth, float frameHeight)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    collect(Player player)
    Called when a Player is collects it.
    protected void
    createBoy(com.badlogic.gdx.math.Vector2 position)
    Creates the body
    void
     
    boolean
    Tells if the collectable is active.
    final boolean
    Tells if it is removable
    void
    Removes the collectable
    void
    update(float deltaTime)
    Updates the Object

    Methods inherited from class de.tum.cit.ase.maze.objects.GameElement

    render

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • light

      protected final box2dLight.PositionalLight light
    • ZOOM

      protected float ZOOM
    • rayHandler

      protected box2dLight.RayHandler rayHandler
    • frameWidth

      protected float frameWidth
    • frameHeight

      protected float frameHeight
    • active

      protected boolean active
    • removable

      protected boolean removable
    • textureAtlas

      protected com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas
    • textureRegion

      protected com.badlogic.gdx.graphics.g2d.TextureRegion textureRegion
  • Constructor Details

    • Collectable

      public Collectable(com.badlogic.gdx.math.Vector2 position, com.badlogic.gdx.physics.box2d.World world, box2dLight.RayHandler rayHandler, com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas)
    • Collectable

      protected Collectable(com.badlogic.gdx.math.Vector2 position, com.badlogic.gdx.physics.box2d.World world, box2dLight.RayHandler rayHandler, com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas, float frameWidth, float frameHeight)
  • Method Details

    • createBoy

      protected void createBoy(com.badlogic.gdx.math.Vector2 position)
      Creates the body
      Parameters:
      position -
    • collect

      public abstract void collect(Player player)
      Called when a Player is collects it.
      Parameters:
      player - the Player that collected it
    • update

      public void update(float deltaTime)
      Description copied from class: GameElement
      Updates the Object
      Specified by:
      update in class GameElement
      Parameters:
      deltaTime - Time since last frame.
    • remove

      public void remove()
      Removes the collectable
    • isRemovable

      public final boolean isRemovable()
      Tells if it is removable
    • isActive

      public boolean isActive()
      Tells if the collectable is active. A collectable should be active if it is NOT in use by a player. If it is active, it can safely not being updated and removed.
      Returns:
      if it is active
    • dispose

      public void dispose()