Tubilok Posted March 27, 2014 Share Posted March 27, 2014 Why when I add an animation the sprite does not show the first frame?this.game.load.spritesheet('loading', 'loading.png', 10, 161);this.loading = this.game.add.sprite(179, 22, 'loading');this.loading.animations.add('loading', [1, 2], 10, true); // Loading sprite show me the frame 1 when I do not call playthis.loading.frame = 0; // I have to do this to put the frame 0 Link to comment Share on other sites More sharing options...
rich Posted March 27, 2014 Share Posted March 27, 2014 I don't really understand the problem. You've added an animation that you've told to start on frame 1. But then set it to frame 0 in the following line. Why not just start the animation at frame 0 too? localGhost 1 Link to comment Share on other sites More sharing options...
Tubilok Posted March 27, 2014 Author Share Posted March 27, 2014 I want to show the first frame of the sprite and make the animation only when you call play(). Is it possible? Or I have to use 2 images, one for the first frame and another one for animation? Link to comment Share on other sites More sharing options...
adamyall Posted March 27, 2014 Share Posted March 27, 2014 I think you're under the impression that setting frame is setting an index for a 0-indexed array lookup.But the .frame is actually a key lookup on frames. You should set .frame to 1 instead. Link to comment Share on other sites More sharing options...
rich Posted March 27, 2014 Share Posted March 27, 2014 this.game.add.sprite(179, 22, 'loading', frameNumberHere);Specify the default frame you want to Sprite to use after the 'loading' parameter. So 1 in your case? Or 0 maybe? I'm not really sure, hard to tell from your messages. Link to comment Share on other sites More sharing options...
Recommended Posts