Results 1 to 4 of 4
  1. #1
    spiil778 is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default Options...Might be advanced rather than new xD

    Hallo Guys. Zanaj here.
    I am new to this forum and I hope you guys can help me. I've made a simple 2d platform game.
    I thought it would be a nice idea to give the user the option to change his/her's controlling keys, but how do you do this?
    As far as I've heard the only way to check wht key is pressed is to make a loop that checks ALL keys and then pick what key is pressed and then write that to my ini file. Is this the only way? Or is there some libery that could make this easier for me?
    Thank you. Have a nice day.
    Sincerly Zanaj (:

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,889
    Rep Power
    8

    Default Re: Options...Might be advanced rather than new xD

    Why do you need to loop through all the keys?

    There are a bunch of ways to do this. You could create a map of key presses to actions, for example. Detect which key was pressed, then look up which action it maps to and do the correct thing. No loops necessary.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    spiil778 is offline Member
    Join Date
    Feb 2013
    Posts
    2
    Rep Power
    0

    Default Re: Options...Might be advanced rather than new xD

    Is there anyway to do this while the window is not in focus? If so can you then post an exemple as I am realtive new to java o: ?

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,889
    Rep Power
    8

    Default Re: Options...Might be advanced rather than new xD

    You can't detect key strokes when the window is not in focus.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Advanced design
    By dominapector in forum AWT / Swing
    Replies: 3
    Last Post: 11-24-2011, 01:26 AM
  2. Looking For Advanced Java Programmer
    By fyfey96 in forum Advanced Java
    Replies: 4
    Last Post: 10-02-2011, 12:53 AM
  3. Advanced extends and implements
    By V1C3M4N in forum Advanced Java
    Replies: 15
    Last Post: 11-17-2010, 01:28 PM
  4. Advanced Looping
    By nuggetman4 in forum New To Java
    Replies: 1
    Last Post: 05-10-2010, 06:54 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •