Original Post
I'm building my own 2D platformer in C++/SDL, but I want to keep it simple and extendable. As such, I'm thinking hard about how to rewrite my sprite classes, specifically the parts that have to do with animation. Simply put, each sprite object should contain some kind of list of rectangle structures (x, y, width, height, all integers) which will specify where on the main sprite sheet, the graphics engine should look to get that sprite's current frame. Since each type of sprite may contain any number of animations and each animation may contain a variable number of frames, the previous classes I've written used a nested vector system for animation. The sprite class contained a vector of animation objects. Each animation object contained a vector of rectangles (frames of animation). So here's an example. sprite object(contains vector of animations as one of its members) animation vector(contains 3 animations so far) animation vector.at(0) == run animation vector.at(1) == jump animation vector.at(2) == shoot run consists of 12 frames of animation jump consists of 8 frames of animation shoot consists of 4 frames of animation My question now is, can anyone think of a better way to organize this? I would prefer to be more conservative with my animation system. Ideas? Advice?