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
FieldsModifier and TypeFieldDescriptionprotected booleanprotected floatprotected floatprotected final box2dLight.PositionalLightprotected box2dLight.RayHandlerprotected booleanprotected com.badlogic.gdx.graphics.g2d.TextureAtlasprotected com.badlogic.gdx.graphics.g2d.TextureRegionprotected floatFields inherited from class de.tum.cit.ase.maze.objects.GameElement
body, texture, world -
Constructor Summary
ConstructorsModifierConstructorDescriptionCollectable(com.badlogic.gdx.math.Vector2 position, com.badlogic.gdx.physics.box2d.World world, box2dLight.RayHandler rayHandler, com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas) protectedCollectable(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 voidCalled when aPlayeris collects it.protected voidcreateBoy(com.badlogic.gdx.math.Vector2 position) Creates the bodyvoiddispose()booleanisActive()Tells if the collectable is active.final booleanTells if it is removablevoidremove()Removes the collectablevoidupdate(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 aPlayeris collects it.- Parameters:
player- thePlayerthat collected it
-
update
public void update(float deltaTime) Description copied from class:GameElementUpdates the Object- Specified by:
updatein 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()
-