Class Traps

All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable

public class Traps extends Collectable
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.
  • 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 world
      world - the Box2D world in which the trap will be simulated
      rayHandler - the RayHandler used for rendering lights and shadows
      textureAtlas - 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 class GameElement
    • collect

      public void collect(Player player)
      Applies a damage effect to the given player when the trap is collected.
      Specified by:
      collect in class Collectable
      Parameters:
      player - the player to whom the damage effect will be applied