azerion / phaser-spine

A plugin for Phaser 2 that adds Spine support
MIT License
121 stars 57 forks source link

[SOLVED]there maybe a bug about setAnimationByName() #23

Closed zk-luke closed 7 years ago

zk-luke commented 7 years ago

I have 5 animations made with spine 3.x . when i use setAniamtion() to change animation ,it doesnt work. if i invoke setMixByName(a,b) and a and b can change,but others still cannot change.

hope to replay. thks man.

please watch the demo here ,click to change animaitons.

repo is here

post: I am not sure , there minght be some different about spine2.x and 3.x at animations section in json files.

AleBles commented 7 years ago

You need to call setToSetupPose after switching the animation

            game.input.onDown.add(function() {
              count++;
              count = count % shit.length;
              symbols.setAnimationByName(0, shit[count], true);
              symbols.setToSetupPose();
              console.log("play", shit[count]);
            });
zk-luke commented 7 years ago

thanks man, it works fine!