• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

From keyboard movement to mouse movement.

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.















 
reply
    Bookmark Topic Watch Topic
  • New Topic