Skip to main content
gamedev.net
🔒 Locked

Animations PRogram

Started by HellRiZZer Jan 20, 2005 at 5:19 PM 3 replies 700+ views
DrZoidberg
DrZoidberg
i'm not exactly sure what you are asking, but, if you have a "sprite sheet" and need to extract specific frames from that image this will be useful.

int x = (frame % columns) * width;
int y = (frame / columns) * height;

so if your image is made up of frames (where X represents a frame), the frame numbers goes like this (4 columns)

1 2 3 4
X X X X
5 6 7 8
X X X X
...

where x and y are the starting positions for the left hand corner of the frame.

this will let you *extract* images from a sprite sheet. if you are refering to gif animations then you can use a gif animation program. what file type are these 2D animations in?
Woop woop woop woop!
HellRiZZer
HellRiZZer
No, what I mean is, for example, I have an image with lots of frames for many different animations, and I want to use ONLY this single bitmap, not load a seperate image file for each and every frame. So, what I'm asking is, is there a program that lets you load that big bitmap and assign frame rectangles and save them?

Thanks.
roos
roos
I used a program like the one you're talking about at my last job, but offhand I'm not sure if there are any programs like this for free... you could try searching on google, maybe there's something. As for the one I used at my job, the way it worked is, basically the artist packs all the images into one texture, and then the programmer or whoever, opens this tool where he can create rectangles (click and drag) around each frame and then save the rectangle information.

For my own games, I wrote a program where you can add a bunch of images/frames to a "texture sheet" and it packs them optimally and saves the UV coordinates of each image. I like this better, though it did involve a lot of extra coding.

Unless you can find a good program online, probably the easiest way to do this is write your own program which displays the image, and then has 4 textboxes where you enter in the top,left coordinates of the rectangle, and width,height. Any time you edit one of the textboxes, a rectangle is overlaid on top of the image using those coordinates. Once you have the rectangle lined up with the part of the image you want to select, then save the coordinates to a file.

roos
HellRiZZer
HellRiZZer
I'm actually in progress of making one using selection rectangles, but I was asking this question in order to find similar programs and see the features they have.
The only problem I'm running into is the running through the array and removing the array elements while running through:
for (int i=0; i<Array.size(); i++){if(SomeCondition == Array.at(i)->m_uiCondition)    Array.remove(i);// The problem lies here, where I cannot resume from the same point OR restart // the 'i' counter to start from the beginning and go through the WHOLE array // after the removal of element with condition.}


Someone please help?

Thanks.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.