working on "How to play"
This commit is contained in:
@@ -40,30 +40,29 @@ void AnimatedSprite::init(LTexture *texture, SDL_Renderer *renderer)
|
||||
// Calcula el frame correspondiente a la animación
|
||||
void AnimatedSprite::animate(int index)
|
||||
{
|
||||
// Calculamos el frame actual a partir del contador
|
||||
mCurrentFrame = mAnimationCounter / mAnimation[index].speed;
|
||||
|
||||
// Si alcanzamos el final de la animación, reiniciamos el contador de la animación
|
||||
// en función de la variable loop
|
||||
if (mCurrentFrame >= mAnimation[index].numFrames)
|
||||
if (mEnabled)
|
||||
{
|
||||
if (mAnimation[index].loop)
|
||||
// Calculamos el frame actual a partir del contador
|
||||
mCurrentFrame = mAnimationCounter / mAnimation[index].speed;
|
||||
|
||||
// Si alcanzamos el final de la animación, reiniciamos el contador de la animación
|
||||
// en función de la variable loop
|
||||
if (mCurrentFrame >= mAnimation[index].numFrames)
|
||||
{
|
||||
mAnimationCounter = 0;
|
||||
if (mAnimation[index].loop)
|
||||
mAnimationCounter = 0;
|
||||
else
|
||||
mCurrentFrame = mAnimation[index].numFrames;
|
||||
}
|
||||
// En caso contrario
|
||||
else
|
||||
{
|
||||
mCurrentFrame = mAnimation[index].numFrames;
|
||||
}
|
||||
}
|
||||
// En caso contrario
|
||||
else
|
||||
{
|
||||
// Escogemos el frame correspondiente de la animación
|
||||
setSpriteClip(mAnimation[index].frames[mCurrentFrame]);
|
||||
// Escogemos el frame correspondiente de la animación
|
||||
setSpriteClip(mAnimation[index].frames[mCurrentFrame]);
|
||||
|
||||
// Incrementamos el contador de la animacion
|
||||
++mAnimationCounter;
|
||||
// Incrementamos el contador de la animacion
|
||||
mAnimationCounter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user