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 ricardohbin

Hi guys.

I have a question: in AnimationSheet, we pass the width and height of each frame in constructor.

But what i do when i have frames with differents width and height. (Ex: frame 2 and 3 have 20x20 and 0 1 4 have 23x25)?

Thanks

1 decade ago by Manuel

you just have to change that property, width or height when you need to changed.

like this:

this.animSheet.width =(new_value);

or
this.animSheet.height =(new_value);

1 decade ago by Xander

I would suggest you build a better sprite sheet.

The height and width of each "frame" in your sprite sheet should be that of the largest sprites in your sheet.

So if you have 5 frames, and the dimensions are 20x20, 23x25, 21x24, 22x,20, 23x24: then in your sprite sheet you should allow for 5 frames of 23x25.

Your sheet size would be 23x5=115 pixels wide by 25x5=125 pixels tall.

115x125 with 5 equally sized frames, then position your sprites in each frame accordingly.
Page 1 of 1
« first « previous next › last »