Using this:
package;
import flixel.FlxG;
import flixel.FlxState;
import flixel.text.FlxText;
class MenuState extends FlxState
{
var text:FlxText;
override public function create():Void
{
text = new FlxText(10, 10, 100);
add(text);
super.create();
}
override public function update(elapsed:Float):Void
{
else text.text = "No controller detected";
super.update(elapsed);
}
}
I'm testing this with one controller, and I am getting different behavior in different targets.
in Flash, it first tells me my controller id is 0. If I unplug the controller and plug it back in, it remains 0.
in Windows and Android (OUYA), the controller id goes up by 1 every time I unplug it and plug it back in.
This makes it impossible for me to determine which controller is for player 1 and which is for player 2 by using the id. (Aside from some wonky code that would just assign it to the first unused id)
Is there a way to get a controller by player number instead of ID?