Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 3 of 3

Thread: 2 player jeopardy (as 2.0)

  1. #1

    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";
            
        }

    PHP Code:
    onClipEvent (enterFrame) {

            
        if (
    Key.isDown(Key.LEFT)){
            
    _root.wp.text += "player 1 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:

            on 
    (release) {
        if (
    Key.isDown(Key.LEFT))
    {
            
                
    this.gotoAndStop(2);
            
            }} 
    Thanks and sorry for bad english
    // Simon

  2. #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.shtml
    MY 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.


  3. #3
    hehe 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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012