Table of Contents

 
GetFrameValue
 

Purpose

Returns the value of the given animation frame

 

Protoype

int CSpriteMngr::GetFrameValue (int i_frame, string str_anim_id = "")
 

Parameters

anim_id the ID of the animation to access
 

Description

This function extracts the value of a specific frame passed in with i_frame. If an animation sequence was {8, 3, 6, 1, 5, 9} and the value of i_frame was 4, then the function would return the value of frame 4, which is 5 (remember that the first frame is always 0). The function will bounds-check to make sure that the frame number passed in is a valid frame number. 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_val = sprite.GetFrameValue();
// access another animation
int i_val2 = sprite.GetFrameValue("nuther_anim");
 

Prev: GetFrameDelay