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 voidaddPlunder(int money)voidaddTarget(Ship target)voidammoUpgrade()Applies a powerup to increase the player's ammo by 5booleancanAttack()If distance to target is less than attack range, target will be null if not in agro range.boolean[]getActiveUpgrades()intgetAmmo()FactiongetFaction()intgetHealth()intgetPlunder()ShipgetTarget()QueueFIFO<Ship>getTargets()voidhealthUpgrade()Powerups below added for assessment 2.booleanisAgro()if dst to target is greater than or equal to attack range target will be null if not in agro rangebooleanisAlive()voidkill()Kill itselfvoidmultiShootUpgrade()Applies a powerup to shoot three cannonballs at onceprotected voidonDeath()Called when an enemy pirate dies.voidreduceDamage()Applies a powerup to reduce the damage taken by the player when fired at by enemy shipsvoidreload(int ammo)Adds ammovoidsetAmmo(int ammo)voidsetFactionId(int factionId)voidsetHealth(int newHealth)voidshoot(com.badlogic.gdx.math.Vector2 dir)Will shoot a cannonball assigning 'this.parent' as the cannonball's parent (must be Ship atm)voidspeedUpgrade()Applies a powerup to increase the player ship's speedvoidtakeDamage(float dmg)com.badlogic.gdx.math.Vector2targetPosition()voidupdateSettings(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()
-
-