Newbie wants to know if one can run two handlers simultaneously
Scott Rossi
scott at tactilemedia.com
Sun Dec 8 15:42:01 EST 2002
>>> I'm attempting to make a simple little shootem up game. I have the
>>> basic shoot
>>> button that draws a line from one loc to the loc of button"enemy"
>>> and plays a
>>> sound effect. What I'd like to do is initiate a handler to move the
>>> button
>>> around the screen(I have that covered) and use the mouseUp handler
>>> from the
>>> shoot btn to stop the first handler from running it shoots, sounds
>>> off and
>>> changes the btn icon. At this point, I have to wait until the first
>>> handler
>>> finishes running before being able to shoot at a motionless target.
>> Sure. One technique I've used is to give each "sprite" object (button,
>> graphic, whatever) its own behavior script. Then you bring each
>> sprite to
>> life using "send <myCommand> to btn sprite1". I've run up to nine
>> sprites
>> simultaneously with barely noticeable slow down on moderately fast
>> machines.
> Send-in-time statements are the best approach now but risk locking out
> mouse events.
I haven't found this is to be the case -- what reproducible problem have you
run up against?
I once created a project that ran around 40 "self-aware" animated sprites
that traveled from the bottom to the top of the screen and reset themselves
autonomously, all while mouse down and up events were captured. I never
encountered any mouse event problems.
(BTW, the project ran fine on Macs but slowed Windows boxes to a crawl or
even a system error :-)
Regards,
Scott Rossi
Creative Director
Tactile Media, Multimedia & Design
Email: scott at tactilemedia.com
Web: www.tactilemedia.com
More information about the use-livecode
mailing list