can someone tell me how to check if a eweapon's sprite has finished animating and is about to loop?
I want to destroy it.
here is the code
const int FFC_EXPLOSION_SPRITE = 96; //Sprite for the explosion. const int FFC_EXPLOSION_SFX = 0; const int FFC_EXPLOSION_EXTEND = 4; //Size of explosion eweapon. const int FFC_EXPLOSION_TILEWIDTH = 2; //Width of explosion, in tiles. const int FFC_EXPLOSION_TILEHEIGHT = 2; //Height of explosion, in tiles. void EnemyExplosions() { int x; int y; for ( int e = 1; e <= Screen->NumNPCs(); e++) { npc enemy = Screen->LoadNPC(e); eweapon explosion; if (enemy->isValid() && enemy->Misc[0] != 1) { if (enemy->HP <= 0) { enemy->Misc[0] = 1; x = enemy->X - 8; y = enemy->Y - 8; explosion = Screen->CreateEWeapon(EW_SCRIPT1); Game->PlaySound(FFC_EXPLOSION_SFX); explosion->CollDetection = false; //...that doesn;t hurt anyone... explosion->X = x; explosion->Y = y; explosion->UseSprite(FFC_EXPLOSION_SPRITE); //...using this sprite explosion->Extend = FFC_EXPLOSION_EXTEND; //...with extended size explosion->TileWidth = FFC_EXPLOSION_TILEWIDTH; //...this many tiles wide explosion->TileHeight = FFC_EXPLOSION_TILEHEIGHT; ///...this many tiles high explosion->CSet = 8; Remove(enemy); //Wait here for animation to end explosion->DeadState = WDS_ARROW; explosion->DeadState = WDS_DEAD; //Kill the dummy eweapon Remove(explosion); //and remove it. } } } }