Announcement

Collapse
No announcement yet.

Get input from 2 controllers

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Get input from 2 controllers

    Anyone know how to get input from two controllers at the same time?

    I am trying to create a "Press Any Button to Start" type of start screen. If the game is started with two controllers plugged in, I would like to be able to detect which controller press any button. Then I would like to make that controller the active controller for the rest of the Menus and game. So I need to either make that controller index 0 or save some type of global variable with the index of the starting controller and pass it to Get Player Controller.

    For testing purposes, I created a blank level and a simple menu. Controller 0 can always control the menu, but Controller 1 cannot access it. I tried overriding On Key Down and I can always get input from Controller 0 and never from Controller 1. Then I created another menu side by side and made sure Controller 1 owns it. I still cannot get a response from Controller 1's button presses.

    Anyone have any ideas?

    Thank you
    Shawn
    I like to make stuff! Current Project: Emily Wants To Play Too http://www.emilywantstoplay.com/

    #2
    You need to create new player for this.
    Click image for larger version

Name:	Безымянный.png
Views:	1
Size:	33.0 KB
ID:	1112317

    Comment


      #3
      Thank you Barnacle.

      I decided to do this:

      I created a blank level with a widget that says Press A to Start.
      I create 4 players ( Just in case! ) to account for 4 controllers.
      I check Gamepad Bottom Face Button. Whoever presses it stays and I remove the other 3 players.
      This causes the engine to reorganize the controllers and gives the one remaining index 0!
      I then add the other 3 players back in case the controller gets disconnected or runs out of power during gameplay. You can't add another one if you don't have any players for it.

      The user that presses A can then be sent to the Main Menu and is the only one that has control.

      Also, instead of removing the users, you can grab the user that presses A and save his index to an integer variable like "InitialUser" then pass that to the menus and gameplay.
      Shawn
      I like to make stuff! Current Project: Emily Wants To Play Too http://www.emilywantstoplay.com/

      Comment

      Working...
      X