Hi all,
I am working on designing an RPG game with my designers and animators and am currently trying to make a prototype using sprites from the handheld pokemon games.
I am however having what seems like a ridiculous problem using an animated sprite.
The setup for the sprite is successful using the simple dbCreateAnimatedSprite() code:
dbCreateAnimatedSprite( 1, "SpriteWalk.png", 24, 1, 1 );
dbSprite( 1, 100, 50, 1 );
I get a weird error when using dbPlaySprite() assigned to the up and down keys. Here's the code for that:
while ( LoopGDK ( ) )
{
if(dbDownKey()==1) {
dbPlaySprite( 1, 1, 3, 200 );
dbMoveSprite( 1, -1 );
}
if(dbUpKey()==1) {
dbPlaySprite( 1, 7, 9, 200 );
dbMoveSprite( 1, 1 );
}
dbSync ( );
}
The code for the down key works perfectly. The sprite loops from frame one to three and moves in the direction that I wanted.
The problem comes when pressing the up key. It seems to start at 1 and scroll all the way to nine before looping from 7 to 9. Is there any way to make it just start from 7 on the press of the up key?
Rob