The DC Layer Cycle library enables modeless background animation in OpenBOR by defining and playing back sequences of layers.
It is designed for background effects that do not need full entity behavior. Instead of spawning models, the library cycles prepared fglayers by enabling the current layer and disabling the previous one. Because disabled layers are skipped by the renderer, inactive frames remain lightweight until needed.
Full tutorial documentation and example modules are available here:
- Animated Background Layers resource at ChronoCrash
- OpenBOR Animated Background Layers tutorial at Caskeys.com
- Layer-based animation sequences
- Multiple independent animations per level
- Fixed or random frame delays
- Frame jumps and random jump ranges
- Runtime layer property mutation
- Automatic cleanup when the level ends
Include the library from any script that will use it.
#include "data/scripts/dc_layer_cycle/main.c"Call setup during the level create event, advance during the level update event, and clean up during the level destroy event.
void oncreate()
{
dc_layer_cycle_setup(1, 11);
dc_layer_cycle_frame_setup(0, 0, 0, 20);
dc_layer_cycle_frame_setup(0, 1, 1, 20);
dc_layer_cycle_frame_setup(0, 2, 2, 20);
dc_layer_cycle_frame_setup(0, 10, 0, DC_LAYER_CYCLE_ACTION_GOTO);
}
void main()
{
dc_layer_cycle_advance();
}
void ondestroy()
{
dc_layer_cycle_cleanup();
}
