Gamepad input in Gamemaker 2

Gamepad input in Gamemaker 2

For this project, we'll focus on adding controller support, in addition to the Mouse and Keyboard combination, of course.

 

So, just to cut to the chase, I'd highly recommend running through Gamemaker's own tutorial on their channel just to get up to speed. I'm going to build off of that as there are some changes, I'm going to be making starting with that. 

These are my current Game Pad values: 

 




Firstly, as much as I like the triggers to be the "Go" buttons, I'd like the Right Trigger to shoot. It makes more sense to me as I squeeze the various buttons that the face buttons are used as a move mechanism. 

 

I'm often told not to touch something if it isn't broken but . . . I'm gonna make changes. This could end in this whole project not working but . . . #YOLO.

According to Gamemaker's Official Manual, once you've gone through the basic implementation, all game pad inputs can be accessed with specific functions. We assigned these already with generic variable names (ex. _move is calling gp_shoulderrb). I'm going to switch the face buttons and the shoulder buttons to see what that feels like.

 

 

Well it worked but I have notes. I don't think I need a _reverse function. So, when I'm accelerating my control behavior is to just turn my ship the opposite direction and speed off that way. When I try making reverse an option I just end up continuing my acceleration since I'm usually facing the opposite direction at that point. 

More importantly, my shoot function is on a timer which I didn't account for when I placed the action. I'll have to update that function toward the bottom of my code. 


 

So, right away I'm seeing a few things. I probably don't need the mouse input calls in these functions as they're already established above so let's get rid of those. The place I'm going wrong is the _stopfire function. That's still mapped to the bottom face button (gp_face1) so it won't fire until that gets a release after being pressed.



It works! Now I have even more notes!

There are a few things missing that I think will really add to the "feel" of this whole process. First, I think, instead of a reverse I just need to implement a full stop. Like, the ship should go through a short period of slowing before coming to a full stop. Secondly, I really feel like I need a booster animation for this just so I can have a visual tell of when you're accelerating. Those will be next on my docket so stay tuned for more!


Need a controller? Get one here!


Back to blog