0

I've been trying to get two controllers working in a MonoGame Project I'm working on and the only Controller that seems to work is 'PlayerIndex.One'. I've tried switching the controller indexes and it won't work whenever it is on anything except 'PlayerIndex.One'

Here is my code, it runs without errors but it still won't work.

if (Robot.IsConnected)
        {
            if (GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.A) || GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.B) || GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.Y) || GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.X))
            {
                if (GamePad.GetState(PlayerIndex.One).Buttons.Y == ButtonState.Pressed)
                {
                    Robot.SendMessage(driveRobot, straight);

                }
if (Robot2.IsConnected)
        {
            if (GamePad.GetState(PlayerIndex.Two).IsButtonDown(Buttons.A) || GamePad.GetState(PlayerIndex.Two).IsButtonDown(Buttons.B) || GamePad.GetState(PlayerIndex.Two).IsButtonDown(Buttons.Y) || GamePad.GetState(PlayerIndex.Two).IsButtonDown(Buttons.X))
            {
                if (GamePad.GetState(PlayerIndex.Two).Buttons.Y == ButtonState.Pressed)
                {
                    Robot.SendMessage(driveRobot2, straight);

                }
Toty
  • 1
  • Are you sure that Windows actually does recognize the two controllers at the same time? Cause if Windows doesn't even detect the second controller, it's not a MonoGame problem. Check Device Manager, or try downloading some third-party software to detect it. – Falgantil Oct 19 '15 at 12:21

1 Answers1

0

You actually deliver the message to Robot the second time as well. Shouldn't this be Robot2

Current:

Robot.SendMessage(driveRobot2, straight);

Should be:

Robot2.SendMessage(driveRobot2, straight);
Sven Möhring
  • 770
  • 13
  • 22