When I press the key that triggers the animation it plays all the frames up to the frames I want played and then starts playing the animation . I tried to fix it with the commented out code but nothing really changed. Can some one point me were the problem is?
-thanks
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbSetDisplayMode(560, 240, 32);//Screen Resolution I dont recommend changing this as you'll just get alot of blackspace.
dbDisableEscapeKey ( );
dbSetImageColorKey ( 255, 0, 255 );//makes the pink on sprites become clear
dbLoadImage ("wall2.bmp",6 );//collision for top of map
dbSprite (6,0,240,6);
dbLoadImage ("wall2.bmp",7 );//collision for bottom of map
dbSprite (7,0,-7,7);
dbLoadImage ("wall1.bmp",4 );//collision for left side of map
dbSprite ( 4,-7,0,4);
dbLoadImage ("wall1.bmp",5);// collision for right side of map
dbSprite ( 5,560,0,5);
dbLoadImage ( "map.bmp", 1 );//Loads Background (grass texture)
dbSprite ( 1, 0, 0, 1 );
int corx = 100;
int cory = 100;
dbCreateAnimatedSprite(2,"character-movesheet.bmp",10,1,2);//Loads walk cycle as well as the character.
dbSprite(2,corx,cory,2);
while ( LoopGDK ( ) )
{
dbSprite(2,corx,cory,2);
if (dbKeyState(18))//SWORD DOWN
{
dbPlaySprite(2,9,10,100);
}
if (dbKeyState(17))//UP
{
//if (dbSpriteFrame(2)<7);
//{
dbPlaySprite(2,7,8,100);
//}
//if (dbSpriteFrame(2)<8);
//{
dbPlaySprite(2,7,8,100);
//}
dbPlaySprite(2,7,8,100);
cory = cory-1;
if (dbSpriteCollision(2,7)==1)
{
cory++;
}
}
if (dbKeyState(31))//DOWN
{
//if (dbSpriteFrame(2)>2);
//{
dbPlaySprite(2,1,2,100);
//}
//if (dbSpriteFrame(2)<1);
//{
dbPlaySprite(2,1,2,100);
//}
dbPlaySprite(2,1,2,100);
cory++;
if (dbSpriteCollision(2,6)==1)
{
cory = cory - 1;
}
}
if (dbKeyState(30))//LEFT
{
dbPlaySprite(2,3,4,100);
corx = corx-1;
if (dbSpriteCollision(2,4)==1)
{
corx++;
}
}
if (dbKeyState(32))//RIGHT
{
dbPlaySprite(2,5,6,100);
corx++;
if (dbSpriteCollision(2,5)==1)
{
corx = corx-1;
}
}
if(dbEscapeKey() == 1)
{
break;
}
dbSync();
}
for ( int m = 1; m < 30; m++ )
dbDeleteSprite(2);
dbDeleteImage ( 1 );
return;
}