Class LaserProjectileComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.projectiles.LaserProjectileComponent
Component for laser projectile entities that handles:
- Movement in a straight line
- Collision detection with player
- Damage dealing
- Hit effect (touchKillEffect) animation
- Auto-disposal after hitting or traveling too far
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionLaserProjectileComponent(com.badlogic.gdx.math.Vector2 direction, float speed, Entity source) Creates a laser projectile component -
Method Summary
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, getPrio, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate
-
Constructor Details
-
LaserProjectileComponent
public LaserProjectileComponent(com.badlogic.gdx.math.Vector2 direction, float speed, Entity source) Creates a laser projectile component- Parameters:
direction- Normalized direction vectorspeed- Movement speedsource- The entity that created this projectile (boss)
-
-
Method Details
-
create
public void create()Description copied from class:ComponentCalled 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()Description copied from class:ComponentCalled once per frame of the game, and should be used for most component logic. Not called if component is disabled. -
dispose
public void dispose()Description copied from class:ComponentCalled when the component is disposed. Dispose of any internal resources here.
-