Couple of points: You shouldn't really be relying on the keyboard repeat in a game. Set a flag on the keydown, and clear it on the keyup. Check the flag periodically (in the main game loop or via a timer) to see what keys are currently held down and act accordingly. No devices have dpads yet. The G1 has a trackball that sends dpad style keypress events, but it's no way usable for games (though it would be interesting to see it used as a real trackball - centipede anybody?!) Make sure you also allow an alternative keyboard control scheme (WSAD perhaps, although a bit close to G1's menu key).
On Dec 23, 4:18 am, ron <ronaldy...@gmail.com> wrote: > Hi, > > I am thinking to write a game that uses the Dpad as the direction > keys. I am expecting to press and hold the Dpad's up/down/left/right > to control my game character to move in those directions. However, > when I test it on the emulator, pressing the Dpad right will first > generate 1 onKeyDown event, then it wait for a long while (~2 seconds) > before generate successive key events.. that's not good for me since > my character will move one step and stop (the first event), then wait > for a second or 2 and it continue to move. > > Anyone has any idea why it happens and anyway to work around it?? > thx. > > Ron --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---