Class ActiveProjectile
java.lang.Object
com.csse3200.game.entities.Entity
com.csse3200.game.entities.configs.projectiles.ActiveProjectile
An extension of current projectile functionality based in Entity, so that it's trajectory and flight path are
affected during runtime. Includes things like following a specific target, and being affected by gravity in a 2D
platformer setting.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
create()
Create the entity and start running.void
Sets the projectile type of this active projectilevoid
setGravityStrength
(float gravityStrength) Sets the gravity strength of the projectile, used if set to ARC projectile type.void
setProjectileSpeed
(float speed) void
Sets the target that the projectile will continuously follow, used if set to FOLLOW_TARGET projectile type.void
update()
Perform an update on all components.Methods inherited from class com.csse3200.game.entities.Entity
addComponent, dispose, earlyUpdate, equals, getCenterPosition, getComponent, getComponents, getEvents, getId, getPosition, getScale, getToRemove, hasComponent, hashCode, scaleHeight, scaleWidth, setEnabled, setPosition, setPosition, setPosition, setScale, setScale, setToRemove, toString
-
Constructor Details
-
ActiveProjectile
public ActiveProjectile()
-
-
Method Details
-
setGravityStrength
public void setGravityStrength(float gravityStrength) Sets the gravity strength of the projectile, used if set to ARC projectile type.- Parameters:
gravityStrength
- The strength of the gravity affecting the projectile
-
setTarget
Sets the target that the projectile will continuously follow, used if set to FOLLOW_TARGET projectile type.- Parameters:
target
- The target entity to follow/home into
-
setActiveProjectileType
Sets the projectile type of this active projectile- Parameters:
type
- The type of this active projectile
-
setProjectileSpeed
public void setProjectileSpeed(float speed) -
create
public void create()Description copied from class:Entity
Create the entity and start running. This is called when the entity is registered in the world, and should not be called manually. -
update
public void update()Description copied from class:Entity
Perform an update on all components. This is called by the entity service and should not be called manually.
-