Package com.mygdx.game.Components
Class Pirate
- java.lang.Object
-
- com.mygdx.game.Components.Component
-
- com.mygdx.game.Components.Pirate
-
public class Pirate extends Component
Gives the concepts of health plunder, etc. Allows for firing of cannonballs, factions, death, targets
-
-
Constructor Summary
Constructors Constructor Description Pirate()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPlunder(int money)
void
addTarget(Ship target)
void
ammoUpgrade()
Applies a powerup to increase the player's ammo by 5boolean
canAttack()
If distance to target is less than attack range, target will be null if not in agro range.boolean[]
getActiveUpgrades()
int
getAmmo()
Faction
getFaction()
int
getHealth()
int
getPlunder()
Ship
getTarget()
QueueFIFO<Ship>
getTargets()
void
healthUpgrade()
Powerups below added for assessment 2.boolean
isAgro()
if dst to target is greater than or equal to attack range target will be null if not in agro rangeboolean
isAlive()
void
kill()
Kill itselfvoid
multiShootUpgrade()
Applies a powerup to shoot three cannonballs at onceprotected void
onDeath()
Called when an enemy pirate dies.void
reduceDamage()
Applies a powerup to reduce the damage taken by the player when fired at by enemy shipsvoid
reload(int ammo)
Adds ammovoid
setAmmo(int ammo)
void
setFactionId(int factionId)
void
setHealth(int newHealth)
void
shoot(com.badlogic.gdx.math.Vector2 dir)
Will shoot a cannonball assigning 'this.parent' as the cannonball's parent (must be Ship atm)void
speedUpgrade()
Applies a powerup to increase the player ship's speedvoid
takeDamage(float dmg)
com.badlogic.gdx.math.Vector2
targetPosition()
void
updateSettings(int difficulty)
-
-
-
Method Detail
-
healthUpgrade
public void healthUpgrade()
Powerups below added for assessment 2. Applies a powerup to increase the player's health by 20
-
ammoUpgrade
public void ammoUpgrade()
Applies a powerup to increase the player's ammo by 5
-
multiShootUpgrade
public void multiShootUpgrade()
Applies a powerup to shoot three cannonballs at once
-
speedUpgrade
public void speedUpgrade()
Applies a powerup to increase the player ship's speed
-
reduceDamage
public void reduceDamage()
Applies a powerup to reduce the damage taken by the player when fired at by enemy ships
-
getActiveUpgrades
public boolean[] getActiveUpgrades()
-
updateSettings
public void updateSettings(int difficulty)
-
addTarget
public void addTarget(Ship target)
-
getPlunder
public int getPlunder()
-
addPlunder
public void addPlunder(int money)
-
getFaction
public Faction getFaction()
-
setFactionId
public void setFactionId(int factionId)
-
takeDamage
public void takeDamage(float dmg)
-
shoot
public void shoot(com.badlogic.gdx.math.Vector2 dir)
Will shoot a cannonball assigning 'this.parent' as the cannonball's parent (must be Ship atm)- Parameters:
dir
- the direction to shoot in
-
reload
public void reload(int ammo)
Adds ammo- Parameters:
ammo
- amount to add
-
getHealth
public int getHealth()
-
setHealth
public void setHealth(int newHealth)
-
canAttack
public boolean canAttack()
If distance to target is less than attack range, target will be null if not in agro range.
-
targetPosition
public com.badlogic.gdx.math.Vector2 targetPosition()
-
isAgro
public boolean isAgro()
if dst to target is greater than or equal to attack range target will be null if not in agro range
-
getTarget
public Ship getTarget()
-
isAlive
public boolean isAlive()
-
kill
public void kill()
Kill itself
-
onDeath
protected void onDeath()
Called when an enemy pirate dies. Added for assessment 2: Gain points and plunder.
-
setAmmo
public void setAmmo(int ammo)
-
getAmmo
public int getAmmo()
-
-