PolyPath (of Motion)

class PolyPath

Defined in PolyPath.sc.

A Motion class that is used to move an Actor to a destination while following a path that avoids polygon obstacles. This is usually what is used to move the ego when the player clicks on a destination. See the init method for more details on parameters.

Example usage:

; Make the thief move to (255, 146), then cue the current object when done.
(theThief setMotion: PolyPath 255 146 self)

Subclasses: PChase, PFollow, MoveFwd.

class diagram

Properties

Inherited from Motion:

Property Description
client The Actor to which this is attached.
caller The object that will get cue()’d when the motion is complete.
x  
y  
dx  
dy  
b-moveCnt  
b-i1  
b-i2  
b-di  
b-xAxis  
b-incr  
completed  
xLast  
yLast  
name  

Defined in PolyPath:

Property Description
value  
points  
finalX  
finalY  
obstacles  

Methods

init(theClient theFinalX theFinalY [theCaller optimizationLevel theObstacles])

Initializes the PolyPath instance.

Parameters:
  • theClient (heapPtr) – The Actor to which this is attached.
  • theFinalX (number) – The target x coordinate.
  • theFinalY (number) – The target y coordinate.
  • theCaller (heapPtr) – The object on which cue() will be called when the target is reached.
  • optimizationLevel (number) – This appears to be unused.
  • theObstacles (heapPtr) – Optional list of polygon obstacles. If not provided, the room’s obstacles are used.
dispose()
moveDone()
setTarget()