Results 1 to 3 of 3
- 03-02-2011, 08:59 AM #1
Member
- Join Date
- Sep 2010
- Posts
- 47
- Rep Power
- 0
Multiple keys pressed, diagonal movement
Hi.
I'm trying to make the character in my game move diagonal, i'm able to make him move diagonal, but i can't make so that if you press Left && Up the UpLeft method gets called..
What i want to know is how do i make so that java accept multiple keys pressed.. my current alternative is to have buttons like q for up, left and e for up, right and so on..
- 03-02-2011, 09:24 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Well, you can be tricky in such cases. Toggle the key-press event in a time frame.
- 03-02-2011, 09:30 AM #3
you can register an action listener to each key you want. read this tutorial and you will know how. in games usually only the keys A, S, D and W are used to move. so to move diagonally you must "look" in that direction and then press W.
Last edited by j2me64; 03-02-2011 at 09:43 AM.
Similar Threads
-
Key/mouse movement
By falkon114 in forum New To JavaReplies: 3Last Post: 02-21-2011, 02:12 AM -
Handling input - multiple keys pressed
By Shadowstrike in forum Advanced JavaReplies: 3Last Post: 12-30-2010, 01:47 PM -
Checking for multiple keys pressed
By MagnusLarsen in forum New To JavaReplies: 15Last Post: 08-22-2010, 11:51 AM -
data structure with multiple keys
By jon80 in forum New To JavaReplies: 2Last Post: 06-13-2009, 03:02 PM -
Movement of balls
By BlitzA in forum New To JavaReplies: 8Last Post: 01-09-2008, 03:30 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks