Press and hold Dpad direction doesn't generate continuous events

by ron » Sat, 27 Dec 2008 07:03:31 GMT


Sponsored Links
 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

--~--~---------~--~----~------------~-------~--~----~



Press and hold Dpad direction doesn't generate continuous events

by andyclap...@googlemail.com » Tue, 30 Dec 2008 03:13:14 GMT


 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).




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. database sqlite doubt

db = dbHelper.getWritableDatabase();
        table = db.rawQuery("select * from PROJECTS", null);
        boolean f = false;
        taskList = new ArrayList<String>();
        while (table.moveToNext()) {
            if (table.getString(1).equals(selectedProject)) {
                f = true;
                taskList.add(table.getString(3));



this is a part of my code...
point is i ve created the tables properly n wen i print the column count n
row count, its all updated...
also durin insert (not shown), i ve checked the return, n it returns the
rowid!!!
there is an exception at the line:                " if
(table.getString(1).equals(selectedProject)) { "     in the above code...

any ideas that might help me to remove the exception???

--~--~---------~--~----~------------~-------~--~----~

2. youtube on android

Hi All,

I want to playback youtube videos on android. I came to know (from the
below mentioned link) that adobe demostrated flash player for android,
but they haven't released the code yet.

http://www.androidauthority.com/index.php/2008/11/17/flash-player-on-android-yes-indeed/

Is there an alternative way to playback youtube video's on android ?
Is there an application that supports flash content playback on
android already (though I couldn't find any on "android market" or
related sites) or any development work is underway ?

Thanks in advance,

Ebin.

--~--~---------~--~----~------------~-------~--~----~

3. Building Android for custom hardware

4. Please enable SVG Support in the Android Webkit Browser

5. HttpUrlConnection.getOutputStream() not working on emulator windows xp

6. Database problem

7. How many Google engineers working on Android?