Arreglado un bug en la eleccion aleatoria de frame de los enemigos
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -40,6 +40,9 @@ public:
|
||||
// Calcula el frame correspondiente a la animación actual
|
||||
void animate();
|
||||
|
||||
// Obtiene el numero de frames de la animación actual
|
||||
int getNumFrames();
|
||||
|
||||
// Establece el frame actual de la animación
|
||||
void setCurrentFrame(int num);
|
||||
|
||||
|
||||
@@ -541,6 +541,8 @@ bool Director::setFileList()
|
||||
asset->add("/../data/enemies/mummy.ani", t_data);
|
||||
asset->add("/../data/enemies/sam.png", t_bitmap);
|
||||
asset->add("/../data/enemies/sam.ani", t_data);
|
||||
asset->add("/../data/enemies/amstrad_character_set.png", t_bitmap);
|
||||
asset->add("/../data/enemies/amstrad_character_set.ani", t_data);
|
||||
|
||||
asset->add("/../data/player/player.png", t_bitmap);
|
||||
asset->add("/../data/player/player.ani", t_data);
|
||||
|
||||
@@ -37,7 +37,7 @@ Enemy::Enemy(enemy_t enemy)
|
||||
collider = getRect();
|
||||
|
||||
// Coloca un frame al azar
|
||||
sprite->setCurrentFrame(rand() % 4);
|
||||
sprite->setCurrentFrame(rand() % sprite->getNumFrames());
|
||||
}
|
||||
|
||||
// Destructor
|
||||
|
||||
@@ -17,7 +17,7 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Asset *asset, Input *input, D
|
||||
|
||||
// ****
|
||||
// this->debug->setEnabled(true);
|
||||
currentRoom = "20.room";
|
||||
currentRoom = "51.room";
|
||||
const int x = 30;
|
||||
const int y = 13;
|
||||
spawnPoint = {x * 8, y * 8, 0, 0, 0, s_standing, SDL_FLIP_HORIZONTAL};
|
||||
|
||||
Reference in New Issue
Block a user