Class CannonBall

    • Constructor Detail

      • CannonBall

        public CannonBall()
        Constructs the cannonball object by generating components
    • Method Detail

      • update

        public void update()
        Called once per frame
        Overrides:
        update in class Entity
      • 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 off
        dir - 2D vector direction for its movement
        sender - 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