Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Dec 2003
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    keyboard hogging

    Hey,

    Ive made a 4 player javascript game and i get the key events like so...

    Code:
    <html>
    <head>
    <script language=javascript>
    
    function getKeyDown(evt){
       if(evt.keyCode==whatever){
          //blah blah blah
       }
    }
    
    </script>
    </head>
    <body onKeyDown="getKeyDown(window.event);">
    </body>
    </html>
    So anyway, when 4 people are playing, and someone holds down a certian
    key, someone elses keys dont work. Is there a way to make them all work
    evenly?

    thanks
    UNDER CONSTRUCTION

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    you can make it work onkeyup or onkeypress, maybe that will work.....
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    Regular Coder
    Join Date
    Dec 2003
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the reply, but when i use onKeyPress, it doesnt work at all.
    and im already using onKeyUp for when the player stops.
    UNDER CONSTRUCTION


  •  

    Posting Permissions

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