Reconnecting Gamepads

  • I am making a local two-player game. The controls work fine except for a minor issue with reconnecting a disconnected controller in 2 player mode.

    Here's a screenshot of my test controls selection screen.

    Through a loop the text at the top is checking each Gamepad of loopindex value. If it detects a controller, it displays its ID. As you can see here, Gamepad 0 and 1 are connected X-Box 360 controllers. (The text is updated 'every tick'.)

    Player 1 is controlled by pad 0, and Player 2 is controlled by pad 1.

    If I unplug pad 1, of course Player 2 has no more pad controls, and as one would expect, reconnecting the pad sets it as pad 1 again and lets it control Player 2. Perfect.

    If I unplug pad 0, Player 1 has no more controls. What was pad 1 and controlled Player 2 becomes pad 0 but curiously does not control Player 1 (nor Player 2). If I replug Player 1's pad, it again becomes pad 0, but it does not control Player 1. Player 2's controller again becomes pad 1, and it does resume controlling Player 2.

    Unplugging and reconnecting all controllers mostly works. The first controller reconnected becomes pad 0 and controls Player 1, so you could end up switching controllers/characters depending on which controller you plug in first. It seems like a finnicky fix for users, however, for Player 1's controller getting accidentally unplugged.

    I suspect this is a bug but I thought I'd check here first.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • So... has anybody experienced this same thing? Is there perhaps another way to refer to a controller to ensure that everybody's controllers remain controlling their appropriate characters?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)