Forums Login/signup

From keyboard movement to mouse movement.

+Pie Number of slices to send: Send
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.















Men call me Jim. Women look past me to this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders


reply
reply
This thread has been viewed 1731 times.
Similar Threads
problem in getPosition and setPosition......
Bouncing Ball program
problem in creating more than one objects
New to Java. Need some proformance suggestions
Balls are not moving
More...

All times above are in ranch (not your local) time.
The current ranch time is
Jul 28, 2025 09:42:05.
close