FlxNestedSprite children update delay



  • Hello,

    Somehow switching from Flash to Flixel wasn't so smooth lately.
    Sorry, but WTF is this? (press "R" to rotate):
    http://www.edgeslide.com/flxnestedsprite/
    Each cube is parented to neighbor to the left. At some point they start to delay by frame.
    If I parent each child to single container, there is no delay while rotating (but i dont want that).

    override public function create():Void
    {
    	container = new FlxNestedSprite();
    	add(container);
    	container.x = 320;
    	container.y = 240;
    	container.makeGraphic(0, 0, FlxColor.TRANSPARENT, true);
    	
    	var i:Int;
    	for (i in 0...20){
    		children.push(new FlxNestedSprite());
    		children[i].relativeX = 15; //
    		children[i].makeGraphic(15, 15, FlxColor.GREEN, true);
    	}
    	for (i in 0...20){
    		if (i == 0) container.add(children[0]); else children[i - 1].add(children[i]);
    	}
    }
    
    
    override public function update(elapsed:Float):Void
    {
    	if (FlxG.keys.pressed.R) container.angle += 3;
    	super.update(elapsed);
    }


  • So you want them to line up or something?



  • Yes I do. When you release 'r' in my example, line gets straight. I want to understand where is this delay coming from. Or maybe there is alternative
    to FlxNestedSprites for simple sprite parenting.


Log in to reply