Table of Contents

 
SetCurrentFrame
 

Purpose

Moves the "playhead" to a specified frame in the animation

 

Protoype

void CSpriteMngr::SetCurrentFrame (int i_frame, string str_anim_id = "")
 

Parameters

frame the frame to move the sequence to
anim_id the ID of the animation to modify
 

Description

This function modifies the position of the playhead in an animation's sequence. The function checks bounds to make sure the frame number supplied with i_frame is indeed a valid frame number in the sequence (remember that all sequences start at 0). If there is already an animation loaded with LoadAnimation(), then you can set the value for that animation without having to specify it. However if there is no loaded animation or you want to access an animation not loaded, then you must pass in its ID for str_anim_id.

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

 

Use

CSpriteMngr sprite;
// access loaded animation
sprite.SetCurrentFrame(5);
// access another animation
sprite.SetCurrentFrame(5, "nuther_anim");
 

Prev: SetAnimDelay