wood burning stoves 2.0*
The moose likes Game Development and the fly likes From keyboard movement to mouse movement. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Game Development
Bookmark "From keyboard movement to mouse movement." Watch "From keyboard movement to mouse movement." New topic
Author

From keyboard movement to mouse movement.

Anna Greene
Greenhorn

Joined: Feb 25, 2013
Posts: 20
So, I have this not-quite-a-game-yet-type thing, which will hopefully evolve into something like Chai RXN over time. there is one fundamental change I want to make, but keep screwing up every time I make it. I want it to be designed so that instead of the keyboard being used to control the player icon, I want the player icon's location to be dictated by the mouse. I tried a near literal translation of everything to do with a keyboardadpter into a mouseAdapter equivalent. All this managed to do was allow me to click instead of using the space bar to fire (now reverted), but it kept the player icon in the same location all the time. Can anyone suggest what the quickest workaround for this problem would be? It seems like the kind of problem where java's OO nature should make the change somewhat easier than with other languages, but I can't figure it out alone.


Note: If anyone wants to try out this code for themselves, they will have to input their own file in the getPlayerImg() method.















 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: From keyboard movement to mouse movement.