Not capable of using DrawCircle (SOLVED)



  • Hello,

    I'm trying to use FlxSpriteUtil's DrawCircle function, but I can only see squares being rendered. Do any of you see anything wrong in this code?

            private var s:FlxSprite;
    
    	override public function create():Void
    	{
    		super.create();
    		s = new FlxSprite(20,20);
    		s.makeGraphic(30, 30,FlxColor.BLUE);
    
    		var manejador1:FlxSprite = new FlxSprite(50,200);
    		manejador1.makeGraphic(20,20,FlxColor.LIME,true);
    		FlxSpriteUtil.drawCircle(manejador1, manejador1.x, manejador1.y, 30, FlxColor.LIME);
    		add(manejador1);
    
    		var manejador2:FlxSprite = new FlxSprite(230,100);
    		manejador2.makeGraphic(20,20,FlxColor.RED,true);
    		FlxSpriteUtil.drawCircle(manejador2, manejador2.x, manejador2.y, 30, FlxColor.RED);
    		add(manejador2);
    		
    		FlxTween.cubicMotion(s, s.x, s.y, manejador1.x, manejador1.y, manejador2.x, manejador2.y, 350, 350, 2);
    		add(s);
    
    	}
    

    Thanks!



  • I guess you need relative coordinates within the sprite, i.e. 0 and 0 instead of manejador1.x and manejador1.y.



  • No luck with this. Tried -1 too, as is said in the API docs, but still the same.



  • Oh, you also draw red on red, and lime on lime. :-)



  • var manejador:FlxSprite = new FlxSprite(100, 100);
    manejador.makeGraphic(20, 20, 0);
    FlxSpriteUtil.drawCircle(manejador, -1 , -1, FlxColor.LIME);
    add(manejador);


  • Ahammm... That was it. Thanks!


Log in to reply
 

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