Actualizado animatedsprite.cpp

This commit is contained in:
2022-10-20 09:18:23 +02:00
parent b949436cd7
commit 57c569677b
2 changed files with 11 additions and 2 deletions

View File

@@ -88,6 +88,12 @@ void AnimatedSprite::animate()
}
}
// Obtiene el numero de frames de la animación actual
int AnimatedSprite::getNumFrames()
{
return (int)animation.at(currentAnimation).frames.size();
}
// Establece el frame actual de la animación
void AnimatedSprite::setCurrentFrame(int num)
{
@@ -304,7 +310,7 @@ bool AnimatedSprite::loadFromFile(std::string filePath)
}
// Pone un valor por defecto
setPos({0, 0, frameWidth, frameHeight});
setRect({0, 0, frameWidth, frameHeight});
return success;
}
@@ -442,7 +448,7 @@ bool AnimatedSprite::loadFromVector(std::vector<std::string> *source)
}
// Pone un valor por defecto
setPos({0, 0, frameWidth, frameHeight});
setRect({0, 0, frameWidth, frameHeight});
return success;
}