Treballant en la intro
This commit is contained in:
@@ -39,13 +39,22 @@ std::vector<SDL_Point> createPath(int start, int end, PathType type, int fixed_p
|
||||
// Actualiza la posición y comprueba si ha llegado a su destino
|
||||
void PathSprite::update()
|
||||
{
|
||||
if (enabled_)
|
||||
if (enabled_ && !has_finished_)
|
||||
{
|
||||
moveThroughCurrentPath();
|
||||
goToNextPathOrDie();
|
||||
}
|
||||
}
|
||||
|
||||
// Muestra el sprite por pantalla
|
||||
void PathSprite::render()
|
||||
{
|
||||
if (enabled_)
|
||||
{
|
||||
Sprite::render();
|
||||
}
|
||||
}
|
||||
|
||||
// Añade un recorrido
|
||||
void PathSprite::addPath(Path path, bool centered)
|
||||
{
|
||||
@@ -151,12 +160,10 @@ void PathSprite::goToNextPathOrDie()
|
||||
// Comprueba si quedan mas recorridos
|
||||
if (current_path_ >= static_cast<int>(paths_.size()))
|
||||
{
|
||||
enabled_ = false;
|
||||
has_finished_ = true;
|
||||
current_path_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Indica si ha terminado todos los recorridos
|
||||
bool PathSprite::hasFinished()
|
||||
{
|
||||
return !enabled_;
|
||||
}
|
||||
bool PathSprite::hasFinished() { return has_finished_; }
|
||||
Reference in New Issue
Block a user