Scriptable animations

Ah! Yesterday I finished the animation system for Tar!. Basically, the engine loads a text file for each sprite, and based on the information contained in these files it loads a specific image file and sets the animation data as defined in this text file.

The content of such a file looks like this:

$sprite player.bmp
$size 128 64
$framesize 32 32
$animation “default”
$frames 0 1 2 2 3 2 4 2
$frametime 50

For now, it suffices, and it’s pretty fun to play around with some test images and animation settings. I might want to write a tool for generating these files and managing my images later on, or refine the system as it’s probably not going to be too manageable with large amounts of sprites. But at this stage, it’s pretty cool to have it up and running. :)

I also added text rendering support (based the same animation system) and I’m working on some primitive drawing functions, like lines and rectangles. Woo, feels good to make progress!

Scriptable animations

Cleaning up :)

Since the collision system showed some undesired results, I decided to clean up the renderer somewhat first before moving on and debugging that thing.

See, all it does right now is loading images, managing all visible objects and rendering them. All of them. After refactoring a game at work, I suddenly realized this system is going to be a bit painfull if I wanted to add some menus… or at least, easy switching between them. Writing a screen system, where each screen is responsible for it’s own list of visible objects, allows some more freedom. I’m also going to tweak the renderers resource management a bit: images that aren’t referred to anymore can be flushed.

And of course, the renderer should be capable of writing text and some basic shapes like lines, dots and rectangles. Those things are going to be usefull for debugging and a console system I want to implement later on. :)

Well, lot’s of idea’s there. Let’s continue implementing them. :)

Cleaning up :)