Class Traps
java.lang.Object
de.tum.cit.ase.maze.objects.GameElement
de.tum.cit.ase.maze.objects.still.collectable.Collectable
de.tum.cit.ase.maze.objects.still.Traps
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
This class represents a trap, which is a type of collectable in the game. Traps can be collected by a player and
have an effect on the player when collected.
Traps inherit from the Collectable class and have additional methods and behavior specific to traps.
-
Field Summary
Fields inherited from class de.tum.cit.ase.maze.objects.still.collectable.Collectable
active, frameHeight, frameWidth, light, rayHandler, removable, textureAtlas, ZOOM
Fields inherited from class de.tum.cit.ase.maze.objects.GameElement
body, texture, world
-
Constructor Summary
ConstructorDescriptionTraps
(com.badlogic.gdx.math.Vector2 position, com.badlogic.gdx.physics.box2d.World world, box2dLight.RayHandler rayHandler, com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas) Constructs a Trap object at the specified position using the given parameters. -
Method Summary
Methods inherited from class de.tum.cit.ase.maze.objects.still.collectable.Collectable
createBoy, dispose, isActive, isRemovable, remove, update
-
Constructor Details
-
Traps
public Traps(com.badlogic.gdx.math.Vector2 position, com.badlogic.gdx.physics.box2d.World world, box2dLight.RayHandler rayHandler, com.badlogic.gdx.graphics.g2d.TextureAtlas textureAtlas) Constructs a Trap object at the specified position using the given parameters.- Parameters:
position
- the position of the trap in the game worldworld
- the Box2D world in which the trap will be simulatedrayHandler
- the RayHandler used for rendering lights and shadowstextureAtlas
- the texture atlas containing the trap's textures
-
-
Method Details
-
render
public void render(com.badlogic.gdx.graphics.g2d.SpriteBatch spriteBatch) Description copied from class:GameElement
Renders the appearance of the game object- Specified by:
render
in classGameElement
-
collect
Applies a damage effect to the given player when the trap is collected.- Specified by:
collect
in classCollectable
- Parameters:
player
- the player to whom the damage effect will be applied
-