• Post Reply Bookmark Topic Watch Topic
  • New Topic

From keyboard movement to mouse movement.  RSS feed

Anna Greene
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!