GameMaker (2.0 - 2.2.x)
Icon

Controller Wizard

Hyomoto

You must be logged in to obtain assets

Description

Try out the included demo!

Controller Wizard is a fast, easy-to-use solution for GM2 that is designed to simplify many common control issues. You can easily rebind controls, consolidate keyboard and gamepad button presses into a single check, easily differentiate between presses, repeats and holds, automatically handle the connection and disconnection of gamepads, mask out conflicting inputs, enforce single object response to controller inputs (or none!), and even gives you a single line double-click! It does all this with very little interaction from the user. It works out-of-the-box (though you'll probably want to customize keyboard controls at least!) and requires no more than a single line to do everything I said above, in fact it probably works the way you always wanted things to:

if control_left == key.press { //do }

That's it! No need to use keyboard_clear, no messy && to also include gamepad inputs, nothing. Just a single, clean, easy-to-read line. What about the mouse? How about:

if mouse_button_left == click.double { // do }

Not to mention, have you ever had an issue where you had multiple objects that could respond to user input but only one of them should? Controller Wizard also provides a extremely flexible-yet-simple solution. If you choose, you can have Controller Wizard call a script or user event on any object, ensuring that only a single object at any time will be affected by your inputs. This also allows you a exceedingly simple way to remove user input should you need to for a cut-scene or scene transition.

This object was designed with ease-of-use and flexibility in mind: after all it's what I use in every one of my projects! I started work on it several years ago, and slowly it has expanded in the resource it is now. After seeing so many questions on the forums about how to handle mouse this, how to handle controller that, I decided why keep it to myself? If you want a easy, all-in-one solution that is literally drag-and-drop into any project then your search is over, it doesn't get any easier than this.

:: INSTALLATION :: Getting CW up and running is easy: simply import all the scripts and obj_controller_wizard into your project, then create an instance of obj_controller_wizard somewhere and voila! Setup is done, and you are ready to put it to work! All controls in CW are customize-able. Most users will probably only need to edit the default keyboard bindings, but should you want to rewrite all the macros they are consolidated into a single file. If you have any questions about implementation, customization or encounter any bugs (I hope not!) or friction, let me know in the support thread, by email or through a PM and I'll resolve it as quickly as possible!

There is a comprehensive readme in the file, but here is a quick overview of how to implement controls with CW:

  • control_left == key.press // checks if the control has been pressed, will repeat like the keyboard
  • control_left & key.pressed // checks if the control is being held down
  • control_left == key.handled // if you don't want a control to repeat, or want to cancel your hold, this control will have to be released before it can be activated again

And that's it! The mouse controls are equally as easy:

  • mouse_button_left == click.single // good old single click
  • mouse_button_left == click.held // mouse button is being held
  • mouse_button_left == click.double // pain-free double-click!
  • mouse_button_left == click.release // there if you need it!
  • mouse_button_left = click.handled // can be used to cancel a button that is being held

The built in controls are as follows:

  • control_left
  • control_right
  • control_up
  • control_down
  • control_A
  • control_B
  • control_X
  • control_Y
  • control_lbumper
  • control_rbumper
  • control_ltrigger
  • control_rtrigger
  • control_lstick
  • control_rstick
  • control_start
  • control_select
  • control_left_stick_direction
  • control_left_stick_force
  • control_right_stick_direction
  • control_right_stick_force
  • control_left_trigger_force
  • control_right_trigger_force
  • mouse_button_left
  • mouse_button_right
  • mouse_button_middle

Here is the list of built-in macros and functions.

Changelog: Version 1.0.3 - Corrected a bug in the release code causing buttons to not respond as expected. Version 1.0.2 - Added 'key.released' when a button is no longer being held.

End User Licence Agreement (EULA).

Age Rating: None

Version

GMS2 - Version 1.0.3. Published May 15, 2019

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait