Hello I am looping 24 sprite animations and for some reason they are not
looping right. It is a sprtie
of captin America Walking, the first 12 are him walking fowar and the other 12
are him walking
backward.
I have them split up in numbers, like
if(!(*KEYS & KEY_RIGHT) && !(frames%5)) // if right key is pressed
{
if(captin.activeFrame < 11)
{
captin.activeFrame++;
sprites[0].attribute2 = captin.spriteFrame[captin.activeFrame];
}
if(captin.activeFrame == 11)
{
captin.activeFrame = 0;
}
if(captin.x < 220)
{
captin.x++;
}
}
frames++;
/*
if(!(*KEYS & KEY_LEFT) && !(frames%5)) // if left key is pressed
{
if(captin.activeFrame < 22)
{
captin.activeFrame++;
sprites[0].attribute2 = captin.spriteFrame[captin.activeFrame];
}
if(captin.activeFrame == 23)
{
captin.activeFrame = 11;
}
if(captin.x > 0)
{
captin.x--;
}
}
I want it to loop through the first twelve when you press right and the last
tweleve when you press left,
but all it does no matter if I press left or right just do one forward then one
backward, one foward then
one back one. I have also tride to making a direction int to control when a
certain direction is pressed it
does something but that doesn't work