Newbie wants to know if one can run two handlers simultaneously

Ken Norris (dialup) pixelbird at interisland.net
Sun Dec 8 20:54:01 EST 2002


> From: MFitz53 at cs.com
> Date: Sun, 8 Dec 2002 11:09:58 EST
> Subject: Newbie wants to know if one can run two handlers simultaneously

> 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.
----------
The replies so far are all great, but I'm wondering if it isn't overkill.
I'm not really sure from your description what is supposed to happen, so I'm
thinking we should simplify this.

The answer to the question is "sure", but one of them needs to be an idle
handler (I'll probably get yelled at for suggesting an idle handler).

What, exactly, is the goal of the gameplay? Can you describe the desired
action a little more?

What I see so far is that you could have 3 buttons and an idle handler:

The "fire" button, the enemy "target" button, and a "temp" that is a copy of
the target button. I'll let you write the script, but here's the basic
outline:

1) Start with the Temp button hidden. Move the Target button with an idle
handler.

2) Shoot with the Fire button. The Fire button gets the current loc of the
Target button, temporarily hides it and shows the Temp button, stationary at
that loc.

3) When you fire, the "ray" goes at the loc of the stationary Temp button.

4) After it "hits", hide the Temp button and show the Target button (which
has actually been in motion the whole time, but invisible.

Of course, I don't see any possibility of missing with this, which is why I
asked about the gameplay.

How about an alternative. Make a progress bar that just moves by time,
starts by clicking it or another "start" button, set it to run out in 60
seconds. Make a Target button that hides and shows at random locs in timed
intervals. You have to run at it with the mouse and click on it before it
moves elsewhere. Record the number of hits before the clock runs out.

That basic idea was designed and the primary scripts written by an
eight-year-old.

HTH,
Ken N.




More information about the Use-livecode mailing list