wijesijp Posted April 3, 2019 Share Posted April 3, 2019 I wanted to play multiple animations with a AnimatedSprite. I setup the animated sprite in following manner. this.spriteSheet = this.loader.resources["images/atlus_runner.json"].spritesheet this.anim = new PIXI.extras.AnimatedSprite( this.spriteSheet.animations["walk"] ); this.anim.animationSpeed = 0.2; this.anim.loop = true; this.anim.play(); this.addChild(this.anim); When I wanted to play another animation, I did it in following manner var newAnim = this.spriteSheet.animations["jump"]; this.anim.stop(); this.anim.textures = newAnim; this.anim.play(); I stop the current animation, set the new textures and play animation again. Is this the correct way of playing another animation? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted April 3, 2019 Share Posted April 3, 2019 There's no "correct" way of playing stuff with AnimatedSprite because everyone uses their own animators based on it. I remember that AnimatedSprite was patched maaaaany times and that class is never enough. People also use different animation loops (not pixi-ticker based). If you go to "make my own animator" route, please look at https://github.com/gameofbombs/pixi-heaven/blob/master/src/animation/AnimationState.ts , usage example: https://github.com/gameofbombs/pixi-heaven#animation . Its good approach "animator-as-component" made by genius @finscn Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.