FlxSpine scaling



  • Hello,
    How to scale FlxSpine after it was initialiazed? As I understand "scale.set" does not work for it.
    Thanks



  • Hey mate,

    You can do it by something like this:

    var root:Bone = skeleton.findBone("root");
    		root.scaleX = 2;
    		root.scaleY = 2;
    

    You can also tweak any scale of any bones you want, to produce effects like this:

    alt text

    Code example:

                            var leftShoulder:Bone = spine.skeleton.findBone("arm_left");
    			var rightShoulder:Bone = spine.skeleton.findBone("arm_right");
    			var torso:Bone = spine.skeleton.findBone("torso");
    			var head:Bone = spine.skeleton.findBone("head");
    			
    			leftShoulder.scaleX = FlxG.random.float(1.5, 0.5);			
    			leftShoulder.scaleY = FlxG.random.float(1.5, 0.5);
    			
    			rightShoulder.scaleX = FlxG.random.float(1.5, 0.5);			
    			rightShoulder.scaleY = FlxG.random.float(1.5, 0.5);
    			
    			torso.scaleX = FlxG.random.float(1.5, 0.5);	
    			torso.scaleY = FlxG.random.float(1.5, 0.5);
    			
    			head.scaleX = FlxG.random.float(1.5, 0.5);			
    			head.scaleY = FlxG.random.float(1.5, 0.5);	
    

    I've been working hard on implementing a proper skeletal animation for my latest platformer, done in HaxeFlixel. Feel free to ask me anything!



  • Claudio, thanks a lot! Works perfect!
    Also for some stupid reason I set key scale value for "root" in Spine animation and nothing worked :D I'm new to Spine and Haxeflixel as well.
    Thanks again!



  • hey, no problem!

    You mean you change the root bone scale, on Spine, and produces no visible effect in-game? Is weird, because it must work. It did, on my older tests.

    Is the bone hierarchy correctly set up?



  • Don't worry, it worked well always! When I started animation scale changed to "1.00" again and again, because I set it in Spine for "root" bone in the first frame :D
    I removed all key frames in "root" and everything works! Thanks!



  • Just noticed thing that disabling "Inrerit >> Scale" for any bone works in Spine and does not in the game. All child bones are scaling in the game according to their parent :(


Log in to reply
 

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