Class NPCShip

    • Field Detail

      • stateMachine

        public com.badlogic.gdx.ai.fsm.StateMachine<NPCShip,​EnemyState> stateMachine
    • Constructor Detail

      • NPCShip

        public NPCShip()
        Creates an initial state machine Changed for Assessment 2: - Added lastShootTime to store the time when the ship last attacked
    • Method Detail

      • update

        public void update()
        Amended for Assessment 2: Added check for life and kills stateMachine and ship in case of death updates the state machine
        Overrides:
        update in class Entity
      • followTarget

        public void followTarget()
        creates a new steering behaviour that will make the NPC beeline for the target (doesn't factor in obstacles)
      • circleOrigin

        public void circleOrigin()
        Added for Assessment 2 Creates a new steering behaviour that will make the NPC circle the college it is attached to (doesn't factor in obstacles)
      • stopMovement

        public void stopMovement()
        stops all movement and sets the behaviour to null
      • directionToShip

        public com.badlogic.gdx.math.Vector2 directionToShip​(Ship ship)
        Added for Assessment 2, calculates the direction an Enemy Ship is in
      • attackShip

        public void attackShip​(Ship ship)
        Added for Assessment 2, shoots a cannonball towards the player ship
      • getCurrentState

        public EnemyState getCurrentState()
        Returns:
        the current state the NPCShip is in