continuously moving a sprite left and right in dark gdk

rabhishek21

Disciple
i'm trying to move a sprite in dark gdk . the problem is code is not executing the condition to turn to the right direction . its continuously moving towards the left ....

here's the code :while ( LoopGDK ( ) )
{

dbSetSpriteFrame(1,2);

dbRotateSprite(1,270);
dbMoveSprite(1,4);
dbRotateSprite(1,0);
int i = dbSpriteX(1);


if(i == 50 ){

dbFlipSprite(1);
dbRotateSprite(1,90);
dbMoveSprite(1,4);
dbRotateSprite(1,0);


}
 
I've no clue about GDK but maybe in the i==50 condition you only flip the sprint and have another if (i > 50) section where you do dbMoveSprite(1, 4) ? The code above that can come below in an "else" section.
 
if(dbSpriteX(1)>10){

dbRotateSprite(1,270);

dbMoveSprite(1,4);

dbRotateSprite(1,0);

}

else{



while(dbSpriteX(1)!=200){

dbFlipSprite(1);

dbRotateSprite(1,90);

dbMoveSprite(1,1);

dbRotateSprite(1,0);

}



}

this is the code .... now the thing is my motion is uniform towards the left but its jumping to the righthand side limit ... the motion i snot continuous
 
Back
Top