Class RangedUseComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.items.ItemActionsComponent
com.csse3200.game.components.items.RangedUseComponent
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)
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class com.csse3200.game.components.items.ItemActionsComponent
create
Methods inherited from class com.csse3200.game.components.Component
dispose, earlyUpdate, getEntity, getPrio, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
RangedUseComponent
public RangedUseComponent()
-
-
Method Details
-
use
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 classItemActionsComponent
- Parameters:
player
- the entity representing the player using the item
-