Window closes when using FlxShapeCircle



  • Hi,

    I started using haxeflixel yesterday.
    When using the FlxShapeCircle function, the window of the haxeflixel compiled result closes (after showing the splash screen). Here is my code:

    package;
    
    import flixel.addons.display.shapes.FlxShapeCircle;
    import flixel.FlxState;
    
    class PlayState extends FlxState
    {
        var circle:FlxShapeCircle; 
        override public function create():Void
        {
    	    super.create();
    	    circle=new FlxShapeCircle(100,100, 100, null,0xFF8899);
        }
    
    }
    

    I also tried this with a FlxShapeBox, and I still get the same issue. Anyone know why this is happening?

    Thanks



  • Is that all the code? You also need an update function (besides create()), otherwise the program just ends. You will also need to add the circle to the state. Using your example:

    package;
    
    import flixel.addons.display.shapes.FlxShapeCircle;
    import flixel.FlxState;
    
    class PlayState extends FlxState
    {
        var circle:FlxShapeCircle; 
        override public function create():Void
        {
    	    super.create();
    	    circle=new FlxShapeCircle(100,100, 100, null,0xFF8899);
                add(circle);   // add circle to the state so it's displayed
        }
    
        override public function update(elapsed:Float):Void
        {
            super.update(elapsed);
        }
    }
    


  • @vasco Thanks for your answer. It helps a lot


Log in to reply
 

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