Okay, so I put this whole thing together for practice to get into dark gdk. I got the contra sprites and edited it to only running. But if you ever played a contra game, you would know that the guy runs to the right, but if you make him run to the left, he TURNS AROUND so his gun is facing the other way. So I edited the sprite sheet for him running to the left and right and this is what I came up with:
First off before I show my code, is it possible to put some type of code that flips the sprite around so I won't need to add the extra frames of him running to the left.
Now, here is the problem, You would think that everything would go okay, atleast for me becuase I put it that when he is running to the right to play frames 2 to 8, but when he runs to the left to play frames 10-16. The problem is when I press my LeftKey, he does move in that directioin, but he plays one animation loop running to the left, then he turns around. It is as if for him to turn around and run, gdk goes through frames 2-8 to get to 10-16.
Here is what I have:
if(dbRightKey())
{
s = 1;
if( x < 600 )
{
dbPlaySprite ( i, 2, 8, 100 );
x = x + 3;
dbSprite ( i, x, 350, i );
}
dbPlaySprite ( i, 1, 1, 100 );
}
if(dbLeftKey())
{
s = 0;
if( x > 0 )
{
dbPlaySprite ( i, 10, 16, 100 );
x = x - 3;
dbSprite ( i, x, 350, i );
}
dbPlaySprite ( i, 9, 9, 100 );
}
if( s == 1 )
{
dbPlaySprite ( i, 1, 1, 100 );
}
else
{
dbPlaySprite ( i, 9, 9, 100 );
}
The S you see in the beginning of the if statements is to show what side he is facing, 0 is for left and 1 is for right. The reason i did this is so when you shoot, it looks to see what s is equal to to see what side he is facing, and shoots to that direction.
But about the Main problem with him turning around. Is there anyway I can fix that?