Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / how are animation bitmap files broken up?

Author
Message
xbandages
12
Years of Service
User Offline
Joined: 30th Mar 2010
Location: Michigan
Posted: 3rd Apr 2010 06:47
when you create the animated sprite, how is the bitmap broken up?

As in, lets say I have an animated sprite .bmp file, it consists of 1 row, 6 frames (evenly spaced apart).

Now lets say that the bmp file has the dimensions 260 x 48 px.

Would the correct dimension for each animation be 260/6 = 43.3333....
Of course since its an integer, the rest would be truncated.

Is this correct?
Krilik
16
Years of Service
User Offline
Joined: 16th Mar 2006
Location: Arizona, USA
Posted: 3rd Apr 2010 12:26
Yes that is correct.

Ideally you would want to create a sprite sheet with dimensions and number of frames that divide evenly so the edges of frames aren't appearing in frames you don't want them to.
Pincho Paxton
20
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 3rd Apr 2010 15:38
You can just load images of course, I actually prefer to do that.

TDK
Retired Moderator
20
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 3rd Apr 2010 15:51
Quote: "Would the correct dimension for each animation be 260/6 = 43.3333....
Of course since its an integer, the rest would be truncated."


It would be your job to ensure that the strip of 6 images was the correct size.

You are also better having each 'cell' of the animation a multiple of 8 pixels - say 48 pixels wide instead of 43.3333.

This would give you an image size of 288x48 pixels containing 6 48x48 sprite images.

When your animation contains larger numbers of frames, you could switch to a 'grid' rather than a 'strip' of images so they are easier to edit in a paint program. For example, up to nine on a 3x3 grid and up to 16 on a 4x4 grid. (It doesn't matter that if you have 7 frames on a 3x3 grid the last two are empty).

TDK

xbandages
12
Years of Service
User Offline
Joined: 30th Mar 2010
Location: Michigan
Posted: 3rd Apr 2010 20:38
@TDK
Oh yeah! i never thought of it that way...I am currently working with 4 separate bitmaps lol. This would make the editing a whole lot easier. I'm not really making my own animations, but i'm using some I found online just to learn how to implement darkGDK's functions to my liking.

THANKS!

Login to post a reply

Server time is: 2023-02-04 22:59:58
Your offset time is: 2023-02-04 22:59:58