Table of Contents

 
GetCurrentFrame
 

Purpose

Returns the current frame of the animation

 

Protoype

int CSpriteMngr::GetCurrentFrame (string str_anim_id = "")
 

Parameters

anim_id the ID of the animation to access
 

Description

This function extracts the current frame of the animation sequence. If a sequence has 5 frames, then the possible values returned by calling this function are 0-4. The current frame is defined as the frame of the sequence currently being rendered on the screen. If there is already an animation loaded with LoadAnimation(), then you can extract the value from 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
int i_curr = sprite.GetCurrentFrame();
// access another animation
int i_curr2 = sprite.GetCurrentFrame("nuther_anim");
 

Prev: GetAnimDelay