The Act class is for actors in the game.
These are the characters which bring your game to life.
Properties
- y
- x
- z
- heading
- yStep
- view
- loop
- cel
- priority
- underBits
- signal
- nsTop
- nsLeft
- nsBottom
- nsRight
- lsTop
- lsLeft
- lsBottom
- lsRight
- brTop
- brLeft
- brBottom
- brRight
- cycleSpeed
- script
- cycler
- timer
- illegalBits
- xLast
- yLast
- xStep
- moveSpeed
- blocks
- baseSetter
- mover
- looper
- viewer
- avoider
Methods
-
void init() |
Initializes the class.
It calls it's super's init(),
then sets the xLast and yLast properties to the x and y properties.
|
-
void doit() |
The doit method is the action
method for the actor, which is executed every interpreter cycle.
If bit 15 of signal is set, it
will return, not doing anything. Otherwise, if the script property
is not NULL, it will call the doit() method in script.
Following, it checks to see if bit 2 of signal is set, and bit
1 is not set. If this is TRUE, it returns.
Next, if the view property is not NULL, it will call the doit()
method in view.
If the avoider property is not NULL, it will call the doit()
method in avoider. Otherwise, if the mover property is not NULL,
it will call the doit() method in mover.
If the cycler property is set, is checks to see if the actor
has moved, and if it "canBeHere".
Finally, it sets the xLast and
yLast properties to the x and y properties.
|
-
void posn(number
newX, number newY[, sendParams]) |
Sets the actor's coordinates.
It calls it's super's posn() method
with newX and newY as the parameters. If specified, it send
the sendParams to the super as well.
It then sets the xLast and yLast to newX and newY.
Finally, it calls the canBeHere() method. If it returns false,
the findPosn() method is called.
|
-
void setLoop([(number/heapPtr)
theLooper, sendParams]) |
Sets the actor's looper object.
If no parameters are given, the
super's setLoop() method is called and it returns.
If theLooper is a loop number, the super's setLoop() method
is called with theLooper as it's parameter, and the sendParams
(if specified).
The old looper property is disposed of. Then, if theLooper is
a class, a new instance of it is created and set to the looper
property. If it's an instance, the looper property is set to
theLooper. Finally, looper's init() method is called, and any
sendParams specified.
|
-
void dispose() |
Disposes of the actor if bit 15
of signal is set.
|
-
void motionCue() |
Cues the actor's motion.
If the motion property is not
NULL and it's completed property is TRUE, it's motionCue() method
is called. Then, the super's
motionCue() method is called.
|
-
void setMotion(heapPtr
theMover[, sendParams]) |
Sets the actor's motion.
If the mover property is not NULL
and not -1, it is disposed of.
Next, if theMover is NULL, mover is set to NULL, and the method
returns.
Otherwise, it calls the startUpd() method and if theMover is
a class, a new instance of it is created and set to the mover
property. If it's an instance, the mover property is set to
theMover. Finally, it calls mover's init() method, and any sendParams
specified.
|
-
void setAvoider(heapPtr
theAvoider[, sendParams]) |
Sets the actor's avoider.
If the avoider property is not
NULL, it is disposed of.
If theAvoider is a class, a new instance of it is created and
set to the avoider property. If it's an instance, the avoider
property is set to theAvoider. Finally, it calls avoider's init()
method, and any sendParams specified.
|
-
void ignoreHorizon([bool
fIGNORE_HORIZON]) |
Sets whether or not the actor
should ignore the horizon.
If no parameters are given, or
fIGNORE_HORIZON is TRUE, bit 13 of signal is set. Otherwise,
it is cleared.
|
-
void observeControl(number(s)
bits) |
Binary ORs the illegalBits property
with the specified parameter values.
|
-
void ignoreControl(number(s)
bits) |
Binary ANDs the illegalBits property
with the BNOT of the specified parameter values.
|
-
void observeBlocks([nodes]) |
If the blocks property is not
set, it is set to a new instance of the Set class.
Next, the add() method of the blocks instance is called with
the specified nodes.
|
-
void ignoreBlocks([nodes]) |
The delete() method of the blocks
instance is called with the specified nodes. After the deleting,
if the blocks set is empty, it is disposed and the blocks property
is set to NULL.
|
-
bool isStopped() |
Returns TRUE is the actor is stopped,
FALSE if otherwise.
|
-
void isBlocked() |
returns TRUE is the actor is blocked,
FALSE otherwise. It checks bit 10 of signal.
|
-
void findPosn() |
Finds the coordinates of the actor,
taking into account if it "canBeHere". It then sets
the x and y properties accordingly.
|
-
bool inRect(number
x1, number y1, number x2, number y2) |
Returns TRUE if the actor is in
the bounds of the specified rectangle, FALSE otherwise.
|
-
bool onControl([bool
fUSE_POINT]) |
Returns TRUE if the actor is on
a control line, FALSE otherwise. If fUSE_POINT is specified,
and TRUE, a point is checked. Otherwise, a bounding rectangle
is.
|
-
numberdistanceTo(heapPtr
pObj) |
Returns the distance from the
x and y properties, to pObj's x and y properties. pObj can be
any object with x and y properties.
|
-
bool canBeHere() |
Checks whether or not the actor
is allowed to be where it is.
|
-
void setStep([number
newX, number newY]) |
Sets the actors step properties.
If the parameters are specified and not equal to -1, the step
properties are set to the given parameters.
After, it calls the mover's init()
method if it can.
|
-
void setDirection(number
direction) |
Sets the actors direction if the
xStep and yStep properties are not equal to zero.
|
|