 |
For example, I might type in an ai_function: (setq tics (+ tick 1))
You can put as many vars as you want, bounded only by what's
sensible and probably a cap on some array in JC's interpreter.
Sub-function: funs
Usage: (func [func-pair]*)
The (funs) function lets you hook you certain functions to
the object's methods. Each [func-pair] is of the form
(fun-type fun-you've-written), where fun-type is one of
the following:
ai_fun - The brain of the object. The ai_fun is called
every tick. Most ai_funs are a finite state machine
using the aistate as a state pointer. The function
you write for ai_fun shouldn't take any arguments.
constructor - Just like a C++ constructor. This function
is called when the object is just created. It takes
no arguments.
damage_fun - The function to be called when this object
takes damage. Arguments? Yes, actually. This funciton
needs to have the same type of arguments as the builtin
do_damage.
draw_fun - The function called whenever an object needs
to be draw. It also takes no arguments.
move_fun - The function called to move the object around.
It takes three parameters: the first is the x direction
(<0 for left >0 for right), the next is the y direction
(<0 for up >0 for down), and the last is the status
of the mouse buttons (bit 1 is set for the right,
bit 2 for the left). I've only seen move functions
on the player, in which case, the three variables just
... Далее >>
|