public abstract class Projectile extends GameObject
Constructor and Description |
---|
Projectile()
Spawns a projectile at position (0,0) with collider size zero.
|
Projectile(float x,
float y,
float width,
float height)
Creates a Projectile with the given (x,y) coordinates and the given collider size.
|
Modifier and Type | Method and Description |
---|---|
void |
fire(float x,
float y,
Human.Direction direction)
Fires the projectile at the given bottom-center (x,y) position and in the given direction.
|
float |
getDamage()
Gets the amount of damage dealt by the projectile when hitting a Human instance.
|
Vector2 |
getFireVelocity()
Gets the velocity at which the projectile is fired when the fire() method is called.
|
void |
hit(Human human)
Called when the projectile hits a Human.
|
void |
setDamage(float damage)
Sets the amount of damage dealt by the projectile when hitting a Human instance.
|
void |
update(float deltaTime)
Updates the Projectile's game logic.
|
canTarget, getAcceleration, getCollider, getObjectId, getPosition, getPreviousPosition, getSkeleton, getStateTime, getTerrainCell, getVelocity, getX, getY, isAbove, moveTo, setAcceleration, setCollider, setObjectId, setPosition, setSkeleton, setStateTime, setTerrainCell, setVelocity, setVelocityX, setVelocityY, setX, setY, updateCollider, updatePosition
public Projectile()
public Projectile(float x, float y, float width, float height)
public void update(float deltaTime)
update
in class GameObject
public void fire(float x, float y, Human.Direction direction)
public void hit(Human human)
public float getDamage()
public void setDamage(float damage)
public Vector2 getFireVelocity()