Table of Contents

 
AssignAnimation
 

Purpose

Replaces the current animation sequence with a new one, or creates a new one if there was no pre-existing animation

 

Protoype

void CTileMngr::AssignAnimation (vector<int> v_animation, bool b_play = true, int i_dir = FORWARDS, int i_fdelay = 1000, 
                                 int i_adelay = 0)
 

Parameters

animation the animation sequence
play whether to play (TRUE) the animation upon load or not (FALSE)
dir the direction of the animation
fdelay the animation frame delay
adelay the animation delay
 

Description

This function creates or replaces the animation for a map tile.

NOTE: In order for the function to work you must have a tile locked with either LockTileRC() or LockTileXY()

Animation Sequences

An animation sequence is a string of numbers that represent cells in the template. All templates start will cell 0, not 1.

NOTE: All animation for tiles are drawn from the map template, not a seperate animation template

Playing and Direction

If you want to immediatly play the animation, then pass in TRUE for b_play. This will automatically load and begin playing the animation. You can also set the direction that the animation will play in, beginning to end (FORWARD) or end to beginning (REVERSE).

Time Delays

An animation can have two seperate delays. The frame delay causes the animation sequence to pause after a frame has been rendered and waits the amount of milliseconds specified with i_fdelay before rendering the next frame. Then there is also the animation delay, specified with i_adelay. This delay starts at the end of the animation, after the last frame delay.

 

Use

CTileMngr tile_mngr;
// create the animation sequence
vector<int> anim;
anim.reserve(3);
anim.push_back(2);
anim.push_back(0);
anim.push_back(4);
// assign the animation
tile_mngr.AssignAnimation(anim, false, FORWARDS, 0, 1000);
 

Prev: Assign