casey 13 Report post Posted March 31, 2018 Hi. I'm having trouble with an animation. The animation is 3 frames, and is a static image until the user ciicks in, and animates it, which should happen in a loop. Instead, the frames play once then the entire thing disappears from the screen. How do I get it to loop? Also, ideally I'd have it loop a number of times then stop. I see there's an example for loop counts in the Phaser documentation, but that doesn't seem to work either... preload: function () { this.load.spritesheet('spritesheet', 'pngs/sprites.png', 99, 79, 3); }, create: function () { this.sprites = this.game.add.sprite(760, 60, 'sprites'); this.sprites.inputEnabled = true; this.sprites.events.onInputDown.add(this.spritesanim, this); } spritesanim: function(){ this.animat = this.sprites.animations.add('swing'); this.animat.play('swing', 20, true); }, Quote Share this post Link to post Share on other sites
onlycape 22 Report post Posted March 31, 2018 Hi @casey, Replace this line: this.animat.play('swing', 20, true); with this: this.animat.play(20, true); Regards. 1 casey reacted to this Quote Share this post Link to post Share on other sites
casey 13 Report post Posted March 31, 2018 cheers! It worked. Quote Share this post Link to post Share on other sites