Table of Contents

 
PlayAnimation
 

Purpose

Plays or stops the current animation

 

Protoype

void CSpriteMngr::PlayAnimation (bool b_play = true, bool b_pause = false)
 

Parameters

play whether to play (TRUE) or stop (FALSE) the animation
pause whether to pause the animation (TRUE) or not (FALSE)
 

Description

This function controls animation playback. When an animation is played or stopped one of two things will happen. If there is no default frame for this animation then the animation will appear to freeze when stopped and then begin from where it left off when started. If there is a default frame for this animation then the animation will revert to that frame when stopped and begin from that frame when started. However, if you pass in TRUE for b_pause, then the function will ignore the presence of a default animation frame (if any) and the animation will freeze when stopped and then begin again from where it left off. You do not have to use this flag when starting a paused animation.

NOTE: There must be a locked sprite object in order for this function to work

 

Use

CSpriteMngr sprite;
// start animation
sprite.PlayAnimation();
// stop animation
sprite.PlayAnimation(false);
 

Prev: PlaceSprite