Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by paulh

Hi all

If i wanted to make a background animation play only once, how would you do that?


// This sets two tiles (tile 0 and tile 5) of any background map with 
// the 'media/tiles.png' tileset to be animated.
var as = new ig.AnimationSheet( 'media/tiles.png', 16, 16 );
this.backgroundAnims = {
    'media/tiles.png': {
        0: new ig.Animation( as, 0.1, [0,1,2,3,4] ),
        5: new ig.Animation( as, 0.2, [5,6,7] )
    }
};
this.loadLevel( MyLevel );


Basically i want the animation to play once and then either stop on a particular frame, reverse or start a new loop after x seconds.

1 decade ago by StuartTresadern

You can to do this for example in your main update:


ig.game.backgroundAnims["media/tiles.png"]["0"].flip.x = true;


loopCount / rewind etc.
http://impactjs.com/documentation/class-reference/animation
Page 1 of 1
« first « previous next › last »