com.b3dgs.lionengine.game.purviews
Interface Pathfindable

All Known Implementing Classes:
AbstractEnemy, AbstractHero, AbstractUnit

public interface Pathfindable

Describe an object which can move on a tile path based map.


Method Summary
 boolean assignDestination(int tx, int ty)
          Assign a specified location; will move automaticaly until reach it.
 void clearIgnoredID()
          Clear all ignored id.
 float getMoveX()
          Get horizontal current speed.
 float getMoveY()
          Get vertical current speed.
 float getSpeedX()
          Get horizontal speed.
 float getSpeedY()
          Get vertical speed.
 int getX()
          Get horizontal location.
 int getXInTile()
          Get horizontal location in tile (location on map).
 int getY()
          Get vertical location.
 int getYInTile()
          Get vertical location in tile (location on map).
 boolean hasReachedDestination()
          Check if has reached destination.
 void ignoreID(int id, boolean state)
          Ignore an id while searching pathfinding.
 boolean isIgnoredID(int id)
          Check if id is ignored.
 boolean isMoving()
          Check is its moving.
 void manualMove(float dx, float dy, float extrp)
          Move to specified destination only on call.
 boolean pathExists(int tx, int ty)
          Check if a path exists bewteen entity and destination.
 void place(int x, int y)
          Set specified location.
 void setArrived(boolean arrived)
          Set arrived state (used to separate the arriving & arrived case).
 void setHackNSlash(boolean state)
          Set specific case for hacknslash game (controling one unit).
 void setSpeed(float speedX, float speedY)
          Set move speed.
 void stopMoves()
          Stop any pathfinding movements.
 void updateMoves(float extrp)
          Update automatic moves if has.
 

Method Detail

manualMove

void manualMove(float dx,
                float dy,
                float extrp)
Move to specified destination only on call.

Parameters:
dx - destination x.
dy - destination y.
extrp - extrapolation value.

assignDestination

boolean assignDestination(int tx,
                          int ty)
Assign a specified location; will move automaticaly until reach it. Location is as tile (not in real value).

Parameters:
tx - destination x (in tile map).
ty - destination y (in tile map).
Returns:
true if target found and valid.

pathExists

boolean pathExists(int tx,
                   int ty)
Check if a path exists bewteen entity and destination.

Parameters:
tx - destination x (in tile map).
ty - destination y (in tile map).
Returns:
true if path exists.

place

void place(int x,
           int y)
Set specified location.

Parameters:
x - location x.
y - location y.

ignoreID

void ignoreID(int id,
              boolean state)
Ignore an id while searching pathfinding. It allows to not be blocked by this id.

Parameters:
id - id to ignore.
state - true to ignore, false else.

isIgnoredID

boolean isIgnoredID(int id)
Check if id is ignored.

Parameters:
id - id to check.
Returns:
true if ignored, false else.

clearIgnoredID

void clearIgnoredID()
Clear all ignored id.


updateMoves

void updateMoves(float extrp)
Update automatic moves if has.

Parameters:
extrp - extrapolation value.

stopMoves

void stopMoves()
Stop any pathfinding movements.


setArrived

void setArrived(boolean arrived)
Set arrived state (used to separate the arriving & arrived case).

Parameters:
arrived - arrived state.

setSpeed

void setSpeed(float speedX,
              float speedY)
Set move speed.

Parameters:
speedX - horizontal speed.
speedY - vertical speed.

setHackNSlash

void setHackNSlash(boolean state)
Set specific case for hacknslash game (controling one unit).

Parameters:
state - state.

isMoving

boolean isMoving()
Check is its moving.

Returns:
true if moving.

hasReachedDestination

boolean hasReachedDestination()
Check if has reached destination.

Returns:
true if destination has been reached.

getSpeedX

float getSpeedX()
Get horizontal speed.

Returns:
horizontal speed.

getSpeedY

float getSpeedY()
Get vertical speed.

Returns:
vertical speed.

getMoveX

float getMoveX()
Get horizontal current speed.

Returns:
horizontal current speed.

getMoveY

float getMoveY()
Get vertical current speed.

Returns:
vertical current speed.

getX

int getX()
Get horizontal location.

Returns:
horizontal location.

getY

int getY()
Get vertical location.

Returns:
vertical location.

getXInTile

int getXInTile()
Get horizontal location in tile (location on map).

Returns:
horizontal location in tile (location on map).

getYInTile

int getYInTile()
Get vertical location in tile (location on map).

Returns:
vertical location in tile (location on map).