Table of Contents | ||||||||||
|
||||||||||
MoveSprite | ||||||||||
Purpose Moves a sprite to a new location relative from its old one |
||||||||||
Protoype void CSpriteMngr::MoveSprite (string str_sprite_id, int i_dx, int i_dy, exclude ex_list = exclude(), int i_flag = LIST_IN) |
||||||||||
Parameters
|
||||||||||
Description This function moves sprites relative from their current position. So if a sprite object is at (100, 200) and you pass in i_dx and i_dy values of 20 and 40, the new location of the spite object will be (120, 240). This function is good for updating the movement of sprites. For absolute positioning you should use PlaceSprite(). Moving Multiple Objects If you want to move more than one sprite object at once the same distance, then you can use the last two parameters of the function. First you must compile a list (an STL vector) of objects that you want to either exclude or include. If you want to move all sprite objects except certain ones, pass those in for ex_list along with the flag LIST_IN. If you want to move only a certain set of objects, pass those in for ex_list along with the flag LIST_OUT. You should also pass ALL_SPRITES for str_sprite_id. |
||||||||||
Use CSpriteMngr sprite; // move one sprite object sprite.MoveSprite("my_sprite", 5, 5); // move ALL sprite objects except "my_sprite" exclude ex_list; ex_list.push_back("my_sprite"); sprite.MoveSprite(ALL_SPRITES, 5, 5, ex_list, LIST_IN); // move ONLY these three sprite objects exclude ex_list; ex_list.push_back("my_sprite1"); ex_list.push_back("my_sprite2"); ex_list.push_back("my_sprite3"); sprite.MoveSprite(ALL_SPRITES, 5, 5, ex_list, LIST_OUT); |
||||||||||
|
||||||||||
|