Archive for October 2008
11
XBOX 360 Controllers in Adobe Flash
31 Comments · Posted by psiba in flash, Game Design, Game Tech, Games, projects
After wanting for many years to be able to get full access to analogue gamepads in flash, a friend showed me the work Thibault Imbert has done to get standard gamepads into flash using a C# socket server and the new ByteArray functionality of actionscript 3.
I took his code and stripped out directx, brought in XNA to grab the XBOX 360 gamepad values and built in support for multiplayer and the ability to specify the polling interval and port number.
I also created an XBOX 360 controller manager class in as3. It manages all the network code for you. Inside the demo flash file you will find four movieclips on the root of the scene and each movieclip is a copy of a nastily hacked together demo showing how to use the manager.
Its quite simple to find out if player 1 has the X button pressed, you simply call
XBOX360Manager.getState(1).X;
To see the data structure of the object passed back by getState, simply check out the com.GamePads.XBOX360GamepadState.
I will work on making an equivalent as2 server, as I myself still like to use as2 for really cheap and nasty gameplay prototypes. Unfortunately without binary socket support in as2, I will need to generate xml, and use an xml socket. This will run slower and will take some time to code… so bare with me or beat me to it!
To download the files check out the projects page.
