Class Trap2

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

public class Trap2 extends Collectable
This class represents a specific type of collectable called "Trap2". It extends the Collectable class and inherits its properties and behaviors.
  • Constructor Details

    • Trap2

      public Trap2(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 Trap2 object.
      Parameters:
      position - the position of the Trap2 object
      world - the world the Trap2 object belongs to
      rayHandler - the rayHandler used for lighting
      textureAtlas - the textureAtlas used to retrieve the sprite
  • Method Details

    • collect

      public void collect(Player player)
      Decreases the player's speed by 25%, and plays a sound effect.
      Specified by:
      collect in class Collectable
      Parameters:
      player - the player object to collect the trap2
    • 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