Android FlxNape how to handle touches ?

  • I am compiling FlxNape for Android .
    While pointer moves correctly on screen I can't get touch to work .
    Is this the correct approach ?

    #if FLX_NO_MOUSE
    import flixel.input.touch.FlxTouch;

    	#if FLX_NO_MOUSE			
    	for (touch in FlxG.touches.list){	
    		var t:FlxPoint = touch.justPressedPosition;				
    		var pt:FlxPoint = 	FlxPoint.get(t.x,t.y);
    		var pt1:FlxPoint = FlxPoint.get(spr.body.position.x, spr.body.position.y);
    		 angle = pt.angleBetween(pt1);

  • EDIT:
    I was testing on Android tv box , removing conditionals in project.xml seems to do the trick .

  • You can also do:

    #if mobile
    for (touch in FlxG.touches.list)
         do stuff;

  • Fact is that tv boxes are like tablets , they do support mouse while being mobile .

Log in to reply

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.