This is a tricky one. You should use the keyPressed.
It does not work with keyDown and keyUp, but is much more useful.
In short:
You need to use the keyDownScript to append pressed keys to a list to
keep track of them. Whenever a key is released you need to check if
the keypressed() = TRUE for all items in the list. The one(s) that is
not keypressed() = TRUE is the one that was released. Remove it from
the list. Do your stuff.
-Andreas
>Hi all,
>
>I'm developing a 4-player (at once, on same screen) skee-ball game where
>players throw balls down an alley to score points and move horses along a
>course to the finish line (insane clients!)
>
>I've got past the most awkward parts - bouncing scripts for the balls when
>they travel down the alleys, scoring, moving balls and horses etc.
>
>I've come up against a problem with the keyboard events. The lingo is
>detecting the 4 player keys fine(a, l, space and return for now), is
>building up the power of the throw OK and is releasing the ball based on
>power and direction on a keyUp event (in the frame script).
>
>When I realised that users will be holding down and releasing keys
>simultaneously I figured I had to rewrite the frame script. This is where
>the problem lies. With keyDown and keyUp events, only the 1st key detected
>is focused on. I have now been trying to use keypressed instead as it allows
>key detection in Lingo loops but am having no joy. It now does detect other
>keys pressed whilst one is held down, but for some reason the keyUp script
>is now ignored (completely - I've tested) and no balls are released.
>
>I guess I'm after any help regarding similar scripts. Has anybody else done
>a multiplayer (simultaneous action) game using keys and if so, can they
>help? Or is the project too ambitious - maybe less players or turn-based
>only will work? I know that turn-based would be easier but this way has been
>specifically requested. If however, someone knows that this is not poss in
>Lingo then I'll have to explain to the client.
>
>frustratedly....8~@
>
>Leon McComish
>Web Developer
>email: [EMAIL PROTECTED]
>
>Get the best free games on the web at
>
>www.freeloader.com
>
>freeloader.com is a division of
>Pure Entertainment Games PLC
>131-151 Great Titchfield Street
>London W1P 8AE
>tel: +44 (0)207 663 3900
>fax: +44 (0)207 663 3901
>
>
>
>[To remove yourself from this list, or to change to digest mode, go to
>http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
>email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
>Lingo-L is for learning and helping with programming Lingo. Thanks!]
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]