Results 1 to 3 of 3
Thread: 2 player jeopardy (as 2.0)
-
May 16th, 2008, 08:21 AM #19Registered User
posts
2 player jeopardy (as 2.0)
Hello, I'm doing a 2 player jeopardy game for a school project and I'm having some problems.
This is how it works: When the players see the question they have to press a button on the keyboard and the player who press first gets to answear.
Lets say player 1 have to press left arrow key and player 2 right arrow key, how do I do so when for example player 1 press the key first player 2's key take no action?
and also when the player who press first gets to answear he has to hold down his key and at the same time press the answear he think is right. So I need something that knows who pressed first to tell what key that need to be pressed to allow an answear.
Heres the code I have atm:
for the key press:
PHP Code:onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)){
_root.wp.text += "player 2 gets to answear";
}
}
for the answear button (here I need something that does that only the player who pressed first gets to answear):PHP Code:onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)){
_root.wp.text += "player 1 gets to answear";
}
}
Thanks and sorry for bad englishPHP Code:
on (release) {
if (Key.isDown(Key.LEFT))
{
this.gotoAndStop(2);
}}
// Simon
-
May 16th, 2008, 09:58 AM #2
in the way you are doing it the statements are being executed one after the other, thereby giving a upperhand to the first key check. so in this situation i would suggest using a key listener. key listeners are described beautifully on this very site...just look for it, and you will get the job done in no time.
Also , this might help http://www.video-animation.com/flash8_024.shtmlMY BLOG
I need a SPRITER who can do pixel arts for an arcade fighter project. If you can help out, please pm me.I also need someone who can write simple xml files.
-
May 16th, 2008, 12:08 PM #39Registered User
postshehe I thought one of my fingers where a bit faster then the other when trying it out because most of the time player 1 won

thanks
//Simon

Reply With Quote
Bookmarks