i have this problem in alpha in Sprite
in the first one fade in and fade out perfect
but in the second one fade in very fast and don't fade out
although i use the same code in the first one
here's the code
plz help me any one
#include <DarkGDK.h>
void DarkGDK ( void ){
dbSyncOn();
dbLoadImage("profileb3.png",2);
dbSprite(2,50,50,2);
int trans=0;
bool appear=false;
int timer=0;
while(LoopGDK())
{
if(trans<255 && appear==false)
dbSetSpriteAlpha(2,trans+=1);
else if(trans<255 && appear==true)
dbSetSpriteAlpha(2,trans-=1);
else
{
if(appear==false)
{
timer=dbTimer()+1000;
appear=true;
}
if(timer<dbTimer())
trans--;
}
if(trans==0 && appear==true)
break;
dbSync();
}
dbDeleteSprite(2);
dbDeleteImage(2);
dbLoadImage("profileb3.png",3);
dbSprite(3,290,290,3);
dbSetSpriteAlpha(3,0);
trans=0;
appear=false;
while(LoopGDK())
{
if(trans<255 && appear==false)
dbSetSpriteAlpha(3,trans+=1);
else if(trans<255 && appear==true)
dbSetSpriteAlpha(3,trans-=1);
else
{
if(appear==false)
{
timer=dbTimer()+1000;
appear=true;
}
if(timer<dbTimer())
trans--;
}
if(trans==0 && appear==true)
break;
dbSync();
}
}