PChase (of PolyPath)¶
-
class
PChase¶ Defined in PChase.sc.
A motion class that is used to make an Actor get within a certain distance of another (possibly moving) object, while avoiding polygon obstacles.
PChase is generally used as an argument for setMotion:
; Make the peasant approach the merchant, within 20 pixels. (peasant setMotion: PChase theMerchant 20)
Properties¶
Inherited from PolyPath:
| Property | Description |
|---|---|
| client | |
| caller | |
| x | |
| y | |
| dx | |
| dy | |
| b-moveCnt | |
| b-i1 | |
| b-i2 | |
| b-di | |
| b-xAxis | |
| b-incr | |
| completed | |
| xLast | |
| yLast | |
| value | |
| points | |
| finalX | |
| finalY | |
| obstacles | |
| name |
Defined in PChase:
| Property | Description |
|---|---|
| who | |
| distance | |
| targetX | |
| targetY |
Methods¶
-
init(theClient theWho [theDistance theCaller theObstacles]) Initializes the PFollow instance.
Parameters: - theClient (heapPtr) – The
Actorto which this is attached. - theWho (heapPtr) – The target to follow.
- theDistance (number) – How close the client needs to get from the target.
- theCaller (heapPtr) – The object on which cue() will be called when the target is reached.
- theObstacles (heapPtr) – Optional list of polygon obstacles. If not provided, the room’s obstacles are used.
- theClient (heapPtr) – The
-
doit()
-
moveDone()
