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
Modifier and Type Method Description voidBeginContact(CollisionInfo info)Called once a collision has being noticesvoidEndContact(CollisionInfo info)Called after the collision has being solvedvoidEnterTrigger(CollisionInfo info)Called on the object that enters the triggervoidExitTrigger(CollisionInfo info)Called upon exiting a triggervoidfire(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.ShipgetShooter()voidkill()Marks cannonball for removal on next update.voidupdate()Similar to the Component's update eventMethods inherited from class com.mygdx.game.Entitys.Entity
addComponent, addComponents, cleanUp, getComponent, getComponent, getComponents, getName, raiseEvents, setNameMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
CannonBall
public CannonBall()
-
-
Method Details
-
update
public void update()Description copied from class:EntitySimilar 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
-
BeginContact
Description copied from interface:CollisionCallBackCalled once a collision has being notices- Specified by:
BeginContactin interfaceCollisionCallBack
-
EndContact
Description copied from interface:CollisionCallBackCalled after the collision has being solved- Specified by:
EndContactin interfaceCollisionCallBack
-
EnterTrigger
Description copied from interface:CollisionCallBackCalled on the object that enters the trigger- Specified by:
EnterTriggerin interfaceCollisionCallBack
-
ExitTrigger
Description copied from interface:CollisionCallBackCalled upon exiting a trigger- Specified by:
ExitTriggerin interfaceCollisionCallBack
-