Hi, i’m trying to create an animation system, and so far i’ve devised a method in which it will take in a specified array of frames to play, and play those frames. However, my problem is, how can I tell the X and Y positions of a frame given the frame index? I need those in order to display the frame at those coordinates. Here is a diagram of what the animation looks like, the frame index is at the top left of each box in the “spritesheet”.
You forgot the diagram?
You can find the frame positions by doing some simple math, but you need to know how many frames you have per column.
Top left corner x = (index % columns) * frameWidth;
Top left corner y = (index / columns) * frameHeight;
haha, my bad. thanks!