Macros
03-02-2009, 05:00 PM
Is there a way to process multiple key presses in java? I'm making a game, a side-scroller applet to be precise, and you move a little guy around with arrow keys. Only problem is, if you hold down the left key, (or right for that matter), and hit jump, it stops registering the the right or left movement, and jumps straight up.
I just thought of maybe having the program move right until the right arrow key is released, instead of just moving right when the right key is pressed, but there has to be an easier way >.< (And I don't know if that will work...)
Thanks, Dioxxipus
EDIT: Canceling the action only on a keyRelease, (instead of checking if the key is down every loop), works, (with a few minor kinks to work out, but still, it works)! I've been trying to get this working for quite some time now, and have searched Google a few times; all the posts I read say that it's either very hard or not possible...
I'm still looking for a different/easier way though, it seems like there must be one.
I just thought of maybe having the program move right until the right arrow key is released, instead of just moving right when the right key is pressed, but there has to be an easier way >.< (And I don't know if that will work...)
Thanks, Dioxxipus
EDIT: Canceling the action only on a keyRelease, (instead of checking if the key is down every loop), works, (with a few minor kinks to work out, but still, it works)! I've been trying to get this working for quite some time now, and have searched Google a few times; all the posts I read say that it's either very hard or not possible...
I'm still looking for a different/easier way though, it seems like there must be one.