Jump to content
  • Advertisement
Sign in to follow this  
homer_3

2 controllers with XNA

This topic is 2949 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does XNA support input from 2 360 controllers connected to a PC? I'd like to make an offline 2 player game. GamePad.GetState() takes a controller index but how does it know which one is player 1 and which is player 2? Is there another API that will set that?

Share this post


Link to post
Share on other sites
Advertisement
Yes, you can use multiple Xbox360 controllers to a PC. I developed my game Xbox Live Indie Game Cyborg Mice Arena on a PC and it supports up to 4 local players.

There is no API that handles everything for you but it helps to write a helper class that has an Update() function that updates the previous and current gamepad states for each controller.

For standard Xbox games, you usually have a START screen that waits for a controller to press Start/A and you set that controller to Player 1. Depending on how your game is set up, if you have some kind of setup/config screen before the gameplay starts, you can listen for other controllers Start/A buttons to see if they want to join and then assign them as Player 2.

You should also handle controller disconnections and probably pause the game if that happens.

I would recommend checking out the samples and forums on creators.xna.com.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!