TIGSource Forums

Developer => Technical => Topic started by: BoxedLunch on January 23, 2011, 11:16:02 AM



Title: gamepad issues
Post by: BoxedLunch on January 23, 2011, 11:16:02 AM
hey everyone, i'm trying to add in gamepads to my versus compo game and due to my recent (just yesterday) learning of how to use them I'm not very familiar as to how to use them. can somebody please explain to me how to add in functions similiar to keyboard_check_pressed and keyboard_check_released functions but with gamepads? because i've checked and i can't find any functions added in there in game-maker's help guide, all i can find is the joystick_check_button function, which is a start, but not really what i want for what i am trying to do (jumping with a gamepad), as it just causes me to bounce whenever my character hits the ground as long as the jump button is pressed.

thanks in advance.


Title: Re: gamepad issues
Post by: Nix on January 23, 2011, 11:26:31 AM
Just do something like this:

if(isJoystickPressed and !wasJoystickPressed)
{
   jump();
}

Does that make sense? Lots of input libraries don't even have buttonPressed and buttonReleased events, so doing what I described is a good thing to know how to do. I'm not 100% sure where you would put the code for everything in GM, but I guarantee that it's possible to do it somewhere.


Title: Re: gamepad issues
Post by: Conker534 on January 23, 2011, 11:39:02 AM
Thanks for that, I needed this as well. x)


Title: Re: gamepad issues
Post by: BoxedLunch on January 23, 2011, 11:45:18 AM
thanks, i'll try it out now. ;D


Title: Re: gamepad issues
Post by: ink.inc on January 23, 2011, 11:46:28 AM
Question to those who know-- do the joystick functions in Game Maker work with a gamepad? I really have no way of testing this, but I would love to implement them in my compo entry.


Title: Re: gamepad issues
Post by: BoxedLunch on January 23, 2011, 11:53:46 AM
Question to those who know-- do the joystick functions in Game Maker work with a gamepad? I really have no way of testing this, but I would love to implement them in my compo entry.
if you mean xbox360 controller then yes, because that is what i'm using, and so far, it works pretty well. i imagine you can use other things as well (usb nes controllers, ps3 controllers, etc.), but it probably requires a bit of knowledge with the functions.

anyway, i got my problem fixed.