Newbie wants to know if one can run two handlers simultaneously

David Vaughan dvk at dvkconsult.com.au
Sun Dec 8 15:00:01 EST 2002


On Monday, December 9, 2002, at 05:28 AM, Scott Rossi wrote:

> Recently, MFitz53 at cs.com wrote:
>
>> 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. 
>> I'm making
>> this for a kid just turned 4 years old, but I think even that would 
>> be pretty
>> unexciting for him. All ideas are appreciated.
>
> 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. The pseudo-threading I wrote about two days ago handles 
this type of programming easily from both a technical and coding 
perspective. In HC I have a 'Beer game' which demonstrates it - supply 
and demand shift in the background and provide graphical reporting 
while you pull the levers of commerce.

regards
David
>
> Regards,
>
> Scott Rossi
> Creative Director
>
> Tactile Media, Multimedia & Design
> Email: scott at tactilemedia.com
> Web: www.tactilemedia.com
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list