Jump to content

  • Log In with Google      Sign In   
  • Create Account


Artur Corrêa

Member Since 02 May 2008
Offline Last Active Feb 20 2014 06:04 AM

#5061942 Correct Input handling algorithm in game

Posted by Artur Corrêa on 14 May 2013 - 06:50 PM

I had this problem before. The solutin was a table.
On the API I was using at the time, keyboard input was made calling a device update method and than checking if a key is active by its code . for instance Readkey('a') would return true if a is active.

I made a wrapper for this API. Inside this class was a table that associates standard keys ( like up for walk and space for jump) with user defined keys. The class had a readkey(method) that receives a standard key and returns the status of the mapped user defined key, by calling the API method.

So, in my game code, I ever check the status of standar keys leting the translation work for the wrapper.


PARTNERS