Alright well I figured out the problem on my own
, but now I have another problems with my sprite sheet playing animations funny
.
The animations work, but when I press up it plays the animation and if I then press left before the animation is finished the up animation will keep playing till its finished then it will switch to the left animation. Making my character look like he is moving left when he is going up
.
Here is the code, I am new at doing animated sprites so I am glad I got this far. Which I got from the Dark Invaders and changed a few things.
// Creates variables that are used to move the character.
int PlayerX = 0;
int PlayerY = 0;
int PlayerSpeed = 1;
int PlayerFrame = 1;
int PlayerFrameDelay = 70;
// Loads the main character and places it on screen.
void playersetup (void)
{
dbCreateAnimatedSprite (24,"Assets\\linksheet.png",13,4,8);
dbSprite (24,PlayerX,PlayerY,8);
dbSetSpriteFrame ( 24 , PlayerFrame );
dbSetSpritePriority ( 24 , 2 );
}
// Whats used in the main loop to help control are character.
void player_refresh (void)
{
// Controls what happens when the player presses the down key.
if (dbDownKey())
{
PlayerY = PlayerY + PlayerSpeed;
dbSprite (24,PlayerX,PlayerY,8 );
dbPlaySprite (24,4,13,PlayerFrameDelay);
}
//Controls what happens when the player presses the up key.
if (dbUpKey())
{
PlayerY = PlayerY - PlayerSpeed;
dbSprite(24,PlayerX,PlayerY,8);
dbPlaySprite (24,40,52,PlayerFrameDelay);
}
// Controls what happens when the player presses the left key.
if (dbLeftKey())
{
PlayerX = PlayerX - PlayerSpeed;
dbSprite (24,PlayerX,PlayerY,8);
dbPlaySprite (24,27,36,PlayerFrameDelay);
}
// Controls what happens when the player presses the right key.
if (dbRightKey())
{
PlayerX = PlayerX + PlayerSpeed;
dbSprite (24,PlayerX,PlayerY,8);
dbPlaySprite (24,17,26,PlayerFrameDelay);
}
dbSetSpriteFrame (8,PlayerFrame);
}
Thanks for any help!