分两种,一种是动画放完后sprite消失
void Change_Sp(void)
{
int i;
for(i=13;i<17;i++)
{
//Check
if(Sprite_Buff[i].sprcell==0)
continue;
if(Sprite_Buff[i].ActKind==0)//if ActKind==0 , this Spirte no movement
continue;
//Timer of Change Sprites's Index
if( ((++Sprite_Buff[i].ChangeIdxCnt)%5)!=0)
continue;
Sprite_Buff[i].sprcell = Sp_Idx_Tab[ Sprite_Buff[i].SpType ][ Sprite_Buff[i].ActKind ][ Sprite_Buff[i].ActCounter ].sprcell;
if( Sp_Idx_Tab[Sprite_Buff[i].SpType][Sprite_Buff[i].ActKind][Sprite_Buff[i].ActCounter+1].sprcell==(const int *)0xffff)//Check End Flag
{
Sprite_Buff[i].ActKind = 0;//Begin Index
Sprite_Buff[i].sprcell = 0;//when action finish ,sprite disappear
}
++Sprite_Buff[i].ActCounter;
}
}
sprite 保持最后一桢 不消失
void Change_Sp(void)
{
int i;
i=0;
//Check
if(Sprite_Buff[i].sprcell==0)
return;
if(Sprite_Buff[i].ActKind==0)
return;
if( ((++Sprite_Buff[i].ChangeIdxCnt)%5)!=0)
return;
Sprite_Buff[i].sprcell = Sp_Idx_Tab[ Sprite_Buff[i].SpType ][ Sprite_Buff[i].ActKind ][ Sprite_Buff[i].ActCounter ].sprcell;
if( Sp_Idx_Tab[Sprite_Buff[i].SpType][Sprite_Buff[i].ActKind][Sprite_Buff[i].ActCounter+1].sprcell==(const int *)0xffff)//Check End Flag
{
Sprite_Buff[i].ActKind = 0;//Begin Index
//Sprite_Buff[i].sprcell = 0;//no disappear
}
++Sprite_Buff[i].ActCounter;
}