Game Design, Programming

Sprites, Animations and the Manager for them

So, what have I been doing since last update?

Well, I have been pretty sick for a while now so have not had the strength to code much but I have been working on our Sprite Manager and Animated Sprite. It think I got it working as I want J

The Sprite Manager loads and stores Textures. It also creates pointers to Sprites and Animated Sprites which other managers need. When an object asks for a Sprite or Animated Sprite the Sprite Manager looks for it in the map that holds the textures. If it can’t find it, it loads and saves a pointer for it otherwise it uses the “old” texture instead. It is kind of waste of memory to load the same texture twice.

The Animated Sprite class has a vector of Frame’s that holds x, y, width, height and duration values for frames of an animation. So each frame holds coordinates for a rectangle of the Texture that is associated with the Sprite and the duration it should be shown before switching to the next.

Up next: Create some guards, load their sprites, position and waypoints from a text-file and make them patrol.

Standard

Leave a comment