Los enemigos ya hacen flip

This commit is contained in:
2022-09-15 17:50:27 +02:00
parent bc2cc28e76
commit 0064bebcc3
5 changed files with 31 additions and 6 deletions

View File

@@ -25,8 +25,8 @@ Room::Room(std::string file_path, SDL_Renderer *renderer, Screen *screen, Asset
texture = new LTexture(renderer, asset->get(tileset));
itemSound = JA_LoadSound(asset->get("item.wav").c_str());
debug->clearLog();
debug->addToLog(tileset);
//debug->clearLog();
//debug->addToLog(tileset);
// Calcula las superficies
setBottomSurfaces();
setTopSurfaces();
@@ -89,6 +89,7 @@ bool Room::load(std::string file_path)
enemy_t enemy;
enemy.asset = asset;
enemy.renderer = renderer;
enemy.flip = false;
do
{
@@ -350,6 +351,11 @@ bool Room::setEnemy(enemy_t *enemy, std::string var, std::string value)
enemy->y2 = std::stoi(value) * BLOCK;
}
else if (var == "flip")
{
enemy->flip = stringToBool(value);
}
else if (var == "color")
{
enemy->color = stringToColor(value);
@@ -775,7 +781,7 @@ void Room::setBottomSurfaces()
i++;
}
debug->addToLog("B: " + std::to_string(line.x1) + "," + std::to_string(line.y) + "," + std::to_string(line.x2) + "," + std::to_string(line.y));
//debug->addToLog("B: " + std::to_string(line.x1) + "," + std::to_string(line.y) + "," + std::to_string(line.x2) + "," + std::to_string(line.y));
}
}
@@ -784,7 +790,7 @@ void Room::setTopSurfaces()
{
std::vector<int> tile;
debug->addToLog(std::to_string(tilemap.size()));
//debug->addToLog(std::to_string(tilemap.size()));
// Busca todos los tiles de tipo muro o pasable que no tengan encima un muro
// Hay que recorrer la habitación por filas (excepto los de la primera fila)
@@ -826,7 +832,7 @@ void Room::setTopSurfaces()
i++;
}
debug->addToLog("T: " + std::to_string(line.x1) + "," + std::to_string(line.y) + "," + std::to_string(line.x2) + "," + std::to_string(line.y));
//debug->addToLog("T: " + std::to_string(line.x1) + "," + std::to_string(line.y) + "," + std::to_string(line.x2) + "," + std::to_string(line.y));
}
}