Package pajammin :: Package ai :: Module pathplanner :: Class WalkerPathPlanner
[show private | hide private]
[frames | no frames]

Class WalkerPathPlanner


A path planner for walkers. Only make nodes for stationary objects (or ones that we'll pretend are stationary, like bouncy platforms).
Method Summary
  __init__(self, level)
  find_path(self, agent, endx, endy)
Try to find a path from here to there; and return a Task object to walk there.
  find_path_astar(self, start, end, agent)
  find_path_greedy(self, start, end, agent)
  link_dist(self, link)
  link_ok(self, link, agent)
  links(self)
  node_dist(self, node1, node2)
  node_ok(self, node, agent)
  nodes(self)
  notify_add_body(self, body)
Called when a new body is added to the level.
  notify_move_body(self, body)
Called when a body is moved (in the level editor only?)
  notify_remove_body(self, body)
Called when a body is removed from the level.
  randomize_dist(self, dist)

Instance Variable Summary
int JUMP_UP_CLEARANCE: The extra clearance which a walker should have when jumping up onto a surface, in pixels.
int MAX_JUMP_HEIGHT: The maximum y distance between two surfaces for which the path planner should consider adding a jump link.
int OPTIMAL_FALL_XVEL: The preferred x velocity at which to fall from one link to another, when a range of different velocities are possible.
int WALK_CLEARANCE: The minimum amount of vertical clearance that a body should have to be represented by a single node.

Class Variable Summary
int MIN_CLEARANCE = 20                                                                    
bool RANDOMIZE_SEARCH = True
str SEARCH_ALGORITHM = 'astar'
int TILE_WIDTH = 20                                                                    
int WINDOW = 40                                                                    

Method Details

__init__(self, level)
(Constructor)

find_path(self, agent, endx, endy)

Try to find a path from here to there; and return a Task object to walk there.

find_path_astar(self, start, end, agent)

find_path_greedy(self, start, end, agent)

link_dist(self, link)

link_ok(self, link, agent)

links(self)

node_dist(self, node1, node2)

node_ok(self, node, agent)

nodes(self)

notify_add_body(self, body)

Called when a new body is added to the level.

notify_move_body(self, body)

Called when a body is moved (in the level editor only?)

notify_remove_body(self, body)

Called when a body is removed from the level.

randomize_dist(self, dist)


Instance Variable Details

JUMP_UP_CLEARANCE

The extra clearance which a walker should have when jumping up onto a surface, in pixels.
Type:
int
Value:
10                                                                    

MAX_JUMP_HEIGHT

The maximum y distance between two surfaces for which the path planner should consider adding a jump link. I.e., the path planner will not add any jump links that require a walker to jump higher than MAX_JUMP_HEIGHT.
Type:
int
Value:
100                                                                   

OPTIMAL_FALL_XVEL

The preferred x velocity at which to fall from one link to another, when a range of different velocities are possible.
Type:
int
Value:
50                                                                    

WALK_CLEARANCE

The minimum amount of vertical clearance that a body should have to be represented by a single node. If any solid objects are in the area above the body's surface and below this clearance, then the body's surface will be encoded as a series of nodes.
Type:
int
Value:
100                                                                   

Class Variable Details

MIN_CLEARANCE

Type:
int
Value:
20                                                                    

RANDOMIZE_SEARCH

Type:
bool
Value:
True                                                                   

SEARCH_ALGORITHM

Type:
str
Value:
'astar'                                                                

TILE_WIDTH

Type:
int
Value:
20                                                                    

WINDOW

Type:
int
Value:
40