Class Collectable
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
A collectable is a
GameElement
that can be collected by a player and then applies an effect to the Player
.-
Field Summary
Modifier and TypeFieldDescriptionprotected 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
ModifierConstructorDescriptionCollectable
(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 TypeMethodDescriptionabstract void
Called when aPlayer
is collects it.protected void
createBoy
(com.badlogic.gdx.math.Vector2 position) Creates the bodyvoid
dispose()
boolean
isActive()
Tells if the collectable is active.final boolean
Tells if it is removablevoid
remove()
Removes the collectablevoid
update
(float deltaTime) Updates the ObjectMethods inherited from class de.tum.cit.ase.maze.objects.GameElement
render
-
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
Called when aPlayer
is collects it.- Parameters:
player
- thePlayer
that collected it
-
update
public void update(float deltaTime) Description copied from class:GameElement
Updates the Object- Specified by:
update
in classGameElement
- 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()
-