Planar Animgs

Introduction

Animgs are animations, and pretty much comprise a list of images and a list of delays. They are how everything is made look pretty, you need to understand them.

Simple Animgs

You most primative animg takes the form filename:delay. In this case, the delay can be anything, but using a delay of 1 is sensible. What this means is 'load the image 'filename' and apply a delay of 'delay'. You can have any number of these pairs, and you separate each pair with another colon. This, for example, is the animg for your players run sequence:

data/player/run0.png:5:data/player/run1.png:5:data/player/run2.png:5:data/player/run3.png:5

See that it references 4 PNG images, and gives them each the same delay of 5 frames.

Special Tokens

Some animgs will start with something taking the form *token; - these are special tokens. They are just added to the start of an animg to add extra functionality (eg. *noloop;) or to reference a 'preloaded' animg from the animg dictionary. For example, the player death sequence is (rather long):

*noloop;data/player/dead0.png:2:data/player/dead1.png:2:data/player/dead2.png:2:data/player/dead3.png:2:data/player/dead4.png:2:data/player/dead5.png:2:data/player/dead6.png:2:data/player/dead7.png:2:data/player/dead8.png:2:data/player/plain.png:10

Technically, the noloop token isn't needed for the actual player, but for bodies who's death doesn't restart everything, this prevents a horrible loop of death occuring.

One other important animg token is the preloaded token, which allows you to use a preloaded token instead. These animg strings take a differnt form to the others of:

*preloaded;preloaded_animg_name

Preloading Animgs

Preloading animgs is an important feature of dynamic gameplay, allow graphical changes to happen more quickly (as new graphics don't have to be loaded). A load function is inplace to allow the preloading of animgs. Animgs must always have a name. This is how to pre-load a simple animg called 'switchOff':

named switchOff animg data/objs/switch0/switchOff.png:1

This can be retrieved with the preloaded token described above.

*preloaded;switchOff

It may also be good to use this method if you reuse an animg alot, as new instances will reference the old one, rather storing lots of new graphics to RAM and re-loading the same thing over and over.