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

10 years ago by WoPr

Hi all!

I wonder to know how can I access to the sprites on a spritesheet of 3 files. If I have a spritesheet like this:

1 2 3 4
5 6 7 8
9

Each "number" is a 8x8 sprite... How I set an animation of 6,7 and 8?

Best regards,
WoPr

10 years ago by John

Why do you have three sprite sheets? You could just put all your spirites on one image that is 32px wide & 24px heigh, then you could use this code:


//Add your sprite sheet's file name and then define the frame dimensions, in your case it would be 8x8 (Width , Height).

animSheet: new ig.AnimationSheet( 'media/yourspritesheet.png', 8, 8),

//Note that the frames always start at 0 like in an array.

this.addAnim( 'idle', .18, [0,1,2,3] );

//So 6,7 and 8 would be 5,6,7

this.addAnim( 'kick', .18, [5,6,7] );


I hope this helped.

10 years ago by WoPr

Hi John,

I do have only one spritesheet, but I thought that I have to use all frames on one line (like in the examples)

This helps a lot :-D

Regards,
WoPr
Page 1 of 1
« first « previous next › last »