• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Gamepad Input ?

C

ChrisMG12

Guest
I'm using the settings tutorial from this vid,
I followed the entire tutorial step by step and did everything correctly and was pretty pleased with my work. However I wanted to add an extra notch to the project, so i decided to add Gamepad support to the game.
But here's the deal though there is a simple way to do this in keyboard, which is keyboard_lastkey (13:34 in the video, you can see the code she used). I soon realized that there is no gamepad alternative, and since I'm a programming noob (GML-wise anyway) I decided to go to the forums and stumbled onto this forum
(https://forum.yoyogames.com/index.p...eck-if-any-input-in-pressed-on-gamepad.10232/)
I thought that this was it and tried to do everything in the forum, including the other forum it links to, and make the IsPressed variable global instead of local. Then I added this in step even :
//Input
case menu_element_type.input:
var kk = keyboard_lastkey;
if(kk != vk_enter){
ds_grid[# 3, menu_option[page]] = kk;
variable_global_set(ds_grid[# 2, menu_option[page]], kk)
}
break;
var gg = global.IsPressed;
if(gg !=gp_start || gp_select || gp_axislh || gp_axislv || gp_axisrh || gp_axisrv || gp_stickl || gp_stickr){
ds_grid[# 3, menu_option[page]] = gg;
variable_global_set(ds_grid[# 2, menu_option[page]], gg)
}
However this doesn't work i also tried to change the values of string_val in draw gui to make it appear but still it doesn't work . Can anyone tell me what I'm doing wrong or tell me what to actually do if this entire thing was a mistake.
 

TailBit

Member
If that is in a switch, then nothing will happen for the bottom part because of the break ending the case

Then there is this line, != is done before ||
if(gg !=gp_start || gp_select || gp_axislh || gp_axislv || gp_axisrh || gp_axisrv || gp_stickl || gp_stickr){
so this will check if gg isn't gp_start .. while the others is mostly constant for positive values and will therefor be considered "true"
if ( true/false || true || true || true || true .. ){
so the result all depend on the first != check, if you want to do all the buttons, then you have to check for each of them:
if !(gg==gp_start || gg==gp_select || ... ){
I moved the ! outside it

EDIT; just noticed the timestamp on this .. so @hardlurker, don't necropost :p
 
Last edited:
Top