Class ChaseCoward
java.lang.Object
edu.uoc.pacman.model.entities.characters.ghosts.chase.ChaseCoward
- All Implemented Interfaces:
ChaseBehaviour
It implements the
It has two different modes which it constantly switches back and forth between, based on its proximity to Pacman.
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 Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
Distance in tiles to decide which position is the target one. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetChasePosition
(Ghost ghost) The ghost will target Pacman's position if the euclidean distance between position is equal to or greater than a distance ofTILES_TO_CHASE
.
-
Field Details
-
TILES_TO_CHASE
private static final int TILES_TO_CHASEDistance in tiles to decide which position is the target one.- See Also:
-
-
Constructor Details
-
ChaseCoward
public ChaseCoward()
-
-
Method Details
-
getChasePosition
The ghost will target Pacman's position if the euclidean distance between position is equal to or greater than a distance ofTILES_TO_CHASE
. Otherwise, the ghost will target its scatter position.- Specified by:
getChasePosition
in interfaceChaseBehaviour
- 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
.
-