Package com.mygdx.game.Entitys
Class CannonBall
- java.lang.Object
-
- com.mygdx.game.Entitys.Entity
-
- com.mygdx.game.Entitys.CannonBall
-
- All Implemented Interfaces:
CollisionCallBack
public class CannonBall extends Entity implements CollisionCallBack
Cannonball entity and the methods to get it flying.
-
-
Constructor Summary
Constructors Constructor Description CannonBall()
Constructs the cannonball object by generating components
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
BeginContact(CollisionInfo info)
`unused`void
EndContact(CollisionInfo info)
`unused`void
EnterTrigger(CollisionInfo info)
`unused`void
ExitTrigger(CollisionInfo info)
`unused`void
fire(Entity sender, com.badlogic.gdx.math.Vector2 pos, com.badlogic.gdx.math.Vector2 dir)
Teleport the cannonball in from offscreen and send in flying away from the ship.java.lang.Float
getAttackDmg()
Added for Assessment 2Faction
getFaction()
Added for Assessment 2void
kill()
Marks cannonball for removal on next update.void
update()
Called once per frame-
Methods inherited from class com.mygdx.game.Entitys.Entity
addComponent, addComponents, cleanUp, dispose, getComponent, getComponent, getName, raiseEvents, setName
-
-
-
-
Method Detail
-
fire
public void fire(Entity sender, com.badlogic.gdx.math.Vector2 pos, com.badlogic.gdx.math.Vector2 dir)
Teleport the cannonball in from offscreen and send in flying away from the ship.- Parameters:
pos
- 2D vector location from where it sets offdir
- 2D vector direction for its movementsender
- ship entity firing it
-
kill
public void kill()
Marks cannonball for removal on next update.
-
getFaction
public Faction getFaction()
Added for Assessment 2- Returns:
- The Faction of the Pirate Component attached to this entity
-
getAttackDmg
public java.lang.Float getAttackDmg()
Added for Assessment 2- Returns:
- the damage dealt by the unit shooting this cannonball
-
BeginContact
public void BeginContact(CollisionInfo info)
`unused`- Specified by:
BeginContact
in interfaceCollisionCallBack
-
EndContact
public void EndContact(CollisionInfo info)
`unused`- Specified by:
EndContact
in interfaceCollisionCallBack
-
EnterTrigger
public void EnterTrigger(CollisionInfo info)
`unused`- Specified by:
EnterTrigger
in interfaceCollisionCallBack
-
ExitTrigger
public void ExitTrigger(CollisionInfo info)
`unused`- Specified by:
ExitTrigger
in interfaceCollisionCallBack
-
-