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()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
BeginContact(CollisionInfo info)
Called once a collision has been noticedvoid
EndContact(CollisionInfo info)
Called after the collision has been solvedvoid
EnterTrigger(CollisionInfo info)
Called on the object that enters the triggervoid
ExitTrigger(CollisionInfo info)
Called upon exiting a triggervoid
fire(com.badlogic.gdx.math.Vector2 pos, com.badlogic.gdx.math.Vector2 dir, Ship sender)
Teleport the cannonball in from offscreen and set in flying away from the ship.Ship
getShooter()
void
kill()
Marks cannonball for removal on next update.void
update()
Similar to the Component's update event-
Methods inherited from class com.mygdx.game.Entitys.Entity
addComponent, addComponents, cleanUp, getComponent, getComponent, getName, raiseEvents, setName
-
-
-
-
Method Detail
-
update
public void update()
Description copied from class:Entity
Similar to the Component's update event
-
fire
public void fire(com.badlogic.gdx.math.Vector2 pos, com.badlogic.gdx.math.Vector2 dir, Ship sender)
Teleport the cannonball in from offscreen and set 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.
-
getShooter
public Ship getShooter()
-
BeginContact
public void BeginContact(CollisionInfo info)
Description copied from interface:CollisionCallBack
Called once a collision has been noticed- Specified by:
BeginContact
in interfaceCollisionCallBack
-
EndContact
public void EndContact(CollisionInfo info)
Description copied from interface:CollisionCallBack
Called after the collision has been solved- Specified by:
EndContact
in interfaceCollisionCallBack
-
EnterTrigger
public void EnterTrigger(CollisionInfo info)
Description copied from interface:CollisionCallBack
Called on the object that enters the trigger- Specified by:
EnterTrigger
in interfaceCollisionCallBack
-
ExitTrigger
public void ExitTrigger(CollisionInfo info)
Description copied from interface:CollisionCallBack
Called upon exiting a trigger- Specified by:
ExitTrigger
in interfaceCollisionCallBack
-
-