GML 2nd gamepad not working

A

anthropus

Guest
Hi all, everything was going good for my GML practice game until i tried getting the 2nd player to work using an xbox controller.

for the key inputs im using

(in the object's create event)
gamepad_set_axis_deadzone(0, .3);

(in a script that is being called for player 2; IS NOT WORKING)
Code:
up = gamepad_axis_value(1,gp_axislv)<0 || gamepad_button_check(1,gp_padu);
down = gamepad_axis_value(1,gp_axislv>0) || gamepad_button_check(1,gp_padd);
left = gamepad_axis_value(1,gp_axislh<0) || gamepad_button_check(1,gp_padl);
right = gamepad_axis_value(1,gp_axislh>0) || gamepad_button_check(1,gp_padr);

(this player 1 script IS WORKING)
Code:
up = gamepad_axis_value(0,gp_axislv)<0 || gamepad_button_check(0,gp_padu);
down = gamepad_axis_value(0,gp_axislv>0) || gamepad_button_check(0,gp_padd);
left = gamepad_axis_value(0,gp_axislh<0) || gamepad_button_check(0,gp_padl);
right = gamepad_axis_value(0,gp_axislh>0) || gamepad_button_check(0,gp_padr);
my guess is that the "1" (for the player 2 script) which defines the gamepad's "'slot' to check" is not the correct. i tried changing the usb port the xbox controller connects to; i tried changing the "1" to "2" and "3" and "4"; i tried reconnecting the gamepad; i tried restarting GMP, and its still nothing is working.
any idea on how i can correct this? how do i check which "slot" the second gamepad (xbox controller) is in?

any help?
 
Do you have two different objects or just one with 2 instances using both scripts?
I would try making a player1 object and a player2 object, and then having each object call it's own script.
 
A

anthropus

Guest
Do you have two different objects or just one with 2 instances using both scripts?
I would try making a player1 object and a player2 object, and then having each object call it's own script.
yes im already using 2 different objects each with their own scripts
 
yes im already using 2 different objects each with their own scripts
Oh I got it, Well I hope I do haha.

Try this in each [EDIT]script:
Code:
if {gamepad_is_connected(1))
{
up = gamepad_axis_value(1,gp_axislv)<0 || gamepad_button_check(1,gp_padu);
down = gamepad_axis_value(1,gp_axislv>0) || gamepad_button_check(1,gp_padd);
left = gamepad_axis_value(1,gp_axislh<0) || gamepad_button_check(1,gp_padl);
right = gamepad_axis_value(1,gp_axislh>0) || gamepad_button_check(1,gp_padr);
}
 
A

anthropus

Guest
tried it, didnt work
but what i did try was changing the input from gamepad to keyboard--and it still isnt working. so now i know its my code elsewhere. will make a new thread. thanks though!
 
Top