Class WeaponArrowProjectileComponent
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.components.combatitemscomponents.WeaponArrowProjectileComponent
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Called when the entity is created and registered.void
setProjectileDirection
(com.badlogic.gdx.math.Vector2 projectileDirection) Sets the projectile's directionvoid
update()
Sets the projectile to move in a certain direction at a certain speed and updates the projectile to keep moving at that speed.Methods inherited from class com.deco2800.game.components.Component
dispose, earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Constructor Details
-
WeaponArrowProjectileComponent
public WeaponArrowProjectileComponent()
-
-
Method Details
-
create
public void create()Description copied from class:Component
Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished. -
update
public void update()Sets the projectile to move in a certain direction at a certain speed and updates the projectile to keep moving at that speed. Also disposes the arrow after 2 seconds by checking the duration of the projectile spawned. -
setProjectileDirection
public void setProjectileDirection(com.badlogic.gdx.math.Vector2 projectileDirection) Sets the projectile's direction- Parameters:
projectileDirection
- the vector direction of the projectile's movement
-