Custom Mouse Controls

Get help using Construct 2

Post » Wed Apr 12, 2017 1:45 am

For keyboard and gamepad objects, I can get the last key or button pressed and assign that input to a variable to customize controls. I can't seem to find any similar actions for the mouse object so I can't let a user change those inputs. Am I missing something or are there any workarounds for this?

Thanks
-Lou
B
80
S
52
G
42
Posts: 370
Reputation: 26,330

Post » Wed Apr 12, 2017 3:28 am

Can you give an example of how you are currently assigning custom keys to your controls? It will be easier to see how best to integrate.

Basically upon entering an "Assign key" state, add events for on left/right/middle mouse clicked - do something. This should be in parallel to your on keyboard key or button pressed.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,696
Reputation: 64,440

Post » Wed Apr 12, 2017 12:14 pm

I have global variables representing all the actions in my game, for example, key_jump. When the user wants to change controls, I wait for input using keyboard.LastKeyCode or gamepad.LastButton and assign that to key_jump. I then call those variables using keyboard.keycode or gamepad(0).buttonindex. That all works fine. However the mouse doesn't seem to have these features. I can't seem to assign an index of a mouse button to a variable. I then can't say on mouse index pressed - do something.
B
80
S
52
G
42
Posts: 370
Reputation: 26,330

Post » Thu Apr 13, 2017 1:36 am

Sorry don't have an answer off the top of my head. I'll experiment a bit when I get the chance to see if there is anything that can be done.
Mistakes were made.
B
53
S
27
G
114
Posts: 1,696
Reputation: 64,440


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 50 guests