forked from jaildesigner-jailgames/jaildoctors_dilemma
Trabajando en los frames iniciales aleatorios de los enemigos
This commit is contained in:
@@ -29,13 +29,7 @@ AnimatedSprite::~AnimatedSprite()
|
||||
int AnimatedSprite::getIndex(std::string name)
|
||||
{
|
||||
int index = -1;
|
||||
/*for (int i = 0; i < (int)animation.size(); i++)
|
||||
{
|
||||
if (animation[i].name == name)
|
||||
{
|
||||
index = i;
|
||||
}
|
||||
}*/
|
||||
|
||||
for (auto a : animation)
|
||||
{
|
||||
index++;
|
||||
@@ -46,7 +40,6 @@ int AnimatedSprite::getIndex(std::string name)
|
||||
}
|
||||
|
||||
printf("** Warning: could not find \"%s\" animation\n", name.c_str());
|
||||
index = 0;
|
||||
|
||||
return -1;
|
||||
}
|
||||
@@ -230,17 +223,23 @@ bool AnimatedSprite::load(std::string filePath)
|
||||
{
|
||||
frames_per_row = std::stoi(line.substr(pos + 1, line.length()));
|
||||
}
|
||||
|
||||
|
||||
else if (line.substr(0, pos) == "frame_width")
|
||||
{
|
||||
frame_width = std::stoi(line.substr(pos + 1, line.length()));
|
||||
|
||||
// Normaliza valores
|
||||
if (frames_per_row == 0)
|
||||
{
|
||||
frames_per_row = texture->getWidth() / frame_width;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else if (line.substr(0, pos) == "frame_height")
|
||||
{
|
||||
frame_height = std::stoi(line.substr(pos + 1, line.length()));
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
printf("Warning: file %s, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
||||
@@ -261,12 +260,6 @@ bool AnimatedSprite::load(std::string filePath)
|
||||
success = false;
|
||||
}
|
||||
|
||||
// Normaliza valores
|
||||
if (frames_per_row == 0)
|
||||
{
|
||||
frames_per_row = texture->getWidth() / frame_width;
|
||||
}
|
||||
|
||||
// Pone un valor por defecto
|
||||
setPos({0, 0, frame_width, frame_height});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user