Reputation: 5273
I have a sprite where every single frame is an image that needs to be displayed individually. Now, what i want to achieve is to show each image with interval, let's say a second or 2.
So far what i've tried:
var frames = [0, 13, 55, 22, 14];
var sprite;
$.each(frames, function (i, axis) {
// x_axis, y_axis is dynamic
sprite[i] = game.add.sprite(x_axis, y_axis, 'sprite', axis);
sprite[i].animations.add('sprite' + i, [axis]);
// I put 2 on second parameter hoping that it will prolong the interval
// but it's not working. Sprites still shows fast like nothing change
sprite[i].animations.play('sprite' + i, 2, false);
});
I also tried putting the sprite aniamations inside a setTimeout
but what happened was, it will have a delay at start then eventually show all sprite image on canvas.
Any help. Just new to Phaser.
Upvotes: 0
Views: 1025
Reputation: 3375
The play time value is in frames per second delay between each frame. Try a much higher value.
Upvotes: 1