V
Vaike
Guest
I found all of the tutorials online and also the GameMaker index for the different constants for the gamepad, but in all of those things I could not figure out how to get the D-pad to work. I had no trouble figuring out the joysticks (that was basically what all of the online tutorials went over) but I would prefer to use the D-pad for movement. I am really bad at GML (just trying to learn by myself) but this is what I came up with.
///gamepad input
var Right = gamepad_button_check(pad_num, gp_padr);
var Left = gamepad_button_check(pad_num, gp_padl);
var Down = gamepad_button_check(pad_num, gp_padd);
var Up = gamepad_button_check(pad_numb, gp_padu);
if (Right != 0)
{
direction = 0;
speed = 40;
}
else
if (Left != 0)
{
direction = 180;
speed = 40;
}
else
if (Down != 0)
{
direction = 270;
speed = 40;
}
else
if (Up != 0)
{
direction = 90;
speed = 40;
}
///gamepad input
var Right = gamepad_button_check(pad_num, gp_padr);
var Left = gamepad_button_check(pad_num, gp_padl);
var Down = gamepad_button_check(pad_num, gp_padd);
var Up = gamepad_button_check(pad_numb, gp_padu);
if (Right != 0)
{
direction = 0;
speed = 40;
}
else
if (Left != 0)
{
direction = 180;
speed = 40;
}
else
if (Down != 0)
{
direction = 270;
speed = 40;
}
else
if (Up != 0)
{
direction = 90;
speed = 40;
}