java.lang.Object
edu.uoc.pacman.model.entities.characters.ghosts.chase.ChaseCoward
All Implemented Interfaces:
ChaseBehaviour

public class ChaseCoward extends Object implements ChaseBehaviour
It implements the ChaseBehaviour interface according to a coward behaviour.
It has two different modes which it constantly switches back and forth between, based on its proximity to Pacman.
  • Field Details

    • TILES_TO_CHASE

      private static final int TILES_TO_CHASE
      Distance in tiles to decide which position is the target one.
      See Also:
  • Constructor Details

    • ChaseCoward

      public ChaseCoward()
  • Method Details

    • getChasePosition

      public Position getChasePosition(Ghost ghost)
      The ghost will target Pacman's position if the euclidean distance between position is equal to or greater than a distance of TILES_TO_CHASE. Otherwise, the ghost will target its scatter position.
      Specified by:
      getChasePosition in interface ChaseBehaviour
      Parameters:
      ghost - Ghost object that chases.
      Returns:
      Position where the ghost must go. Pacman's position if the euclidena distance is equal to or greater than TILES_TO_CHASE. Otherwise, ghost's scatter position.
      Since:
      getChasePosition in interface ChaseBehaviour.