new version 2.1 (27-05-2018)
- No more double key binds, 1 key per bind, if you use an already used key then the key bind using that key will be set to blank.
Let the user/player set his own key and mouse bindings.
How it works:
- On a press of a button the script listen to our keyboard and mouse, once we get an input we put it into the global dict.
- The global dict is used to save, load and use all the keybindings.
How to use:
- Hit K to open the keybindings menu.
- Click on a button to set a new key or mouse button.
- Hit save or the close button to save and close the menu
How to port it to your game:
- Import the empty from the main scene into your main scene.
- Import the keybindings scene into your blend file (file->append).
- Make sure you have keybindings.py and my_functions.py aswell.
- Go to keybindings.py and change the scene names at the top of the script
How to add more Buttons/keys:
- Select 1 button and the text object, duplicate it, change the property to your likings
- Now go to keybindings.py head to def default_keybindings(cont): and set the key there as well
Key and mouse bindings in action: (showing older version, but you get the idea)
key and mouse bindings.blend (689.4 KB)
(Ignore the last comment in the Readme, forgot to remove it)
if you need a movement script attached to it: First Person movement script with Key and mouse bindings
As always if you like it or gonna use it leave a reply, thanks!