Class RangedUseComponent


public class RangedUseComponent extends ItemActionsComponent
Component responsible for handling ranged item usage (e.g., guns, bombs).

When used, this component:

  • Plays an attack sound
  • Creates a projectile entity (bullet or bomb)
  • Fires the projectile toward the mouse input
  • If the item is a consumable bomb, schedules its timed behavior (rotation, pulsing, stopping, and explosion)
  • Constructor Details

    • RangedUseComponent

      public RangedUseComponent()
  • Method Details

    • use

      public void use(Entity player)
      Uses the ranged weapon/item for the given player.

      Spawns and fires a projectile toward the cursor position. If the item is a consumable (e.g., bomb), schedules delayed explosion behavior.

      Specified by:
      use in class ItemActionsComponent
      Parameters:
      player - the entity representing the player using the item