I have a basic 128x128, 16-frame player sheet. The top four frames are for the north-walking animation, the upper-middle four are for east-walking, the lower-middle are for south-walking, and the bottom four are west-walking. So, with four frames across each row:
North
East
South
West
The important parts of the code that I have are below:
if(dbUpKey())
{
dbPlaySprite ( usrImage, 1, 4, 300 );
usrY -= 1;
}
if(dbRightKey())
{
dbPlaySprite ( usrImage, 5, 8, 300 );
usrX += 1;
}
if(dbDownKey())
{
dbPlaySprite ( usrImage, 9, 12, 300 );
usrY += 1;
}
if(dbLeftKey())
{
dbPlaySprite ( usrImage, 13, 16, 300 );
usrX -= 1;
}
For reference, the syntax for dbPlaySprite is:
( int iID, int iStart, int iEnd, int iDelay )
So, with my code, let's say I press up to walk north. Great, everything works fine. With a little extra code, not included in the snippet above, I can get the sprite to "stand still" by displaying a specific frame while no directional buttons are being pressed. No problems there. But then, after walking north, I press down to walk south. Instead of cutting to the specified iStart value of frame 9, dbPlaySprite runs through all of the frames - from whichever frame I'm at before I press down, up to the specified iEnd value of frame 12, where it will THEN loop back to frame 9.
So, in effect, if the player's sprite is facing north, and I want to walk south, it first displays the rest of the north-walking frames, then all of the east-walking frames, and then, finally, begins the south-walking animation loop.
Is there any way to skip DIRECTLY to the specified iStart frame?
neguz