forked from jaildesigner-jailgames/jaildoctors_dilemma
Trabajando en el modo pausa
This commit is contained in:
@@ -11,6 +11,7 @@ Room::Room(std::string file_path, SDL_Renderer *renderer, Screen *screen, Asset
|
||||
mapWidth = 32;
|
||||
mapHeight = 16;
|
||||
tilesetWidth = 20;
|
||||
paused = false;
|
||||
|
||||
// Copia los punteros a objetos
|
||||
this->renderer = renderer;
|
||||
@@ -25,9 +26,9 @@ 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);
|
||||
// Calcula las superficies
|
||||
// debug->clearLog();
|
||||
// debug->addToLog(tileset);
|
||||
// Calcula las superficies
|
||||
setBottomSurfaces();
|
||||
setTopSurfaces();
|
||||
setLeftSurfaces();
|
||||
@@ -569,13 +570,18 @@ void Room::renderItems()
|
||||
// Actualiza las variables y objetos de la habitación
|
||||
void Room::update()
|
||||
{
|
||||
if (paused)
|
||||
{//Si está en modo pausa no se actualiza nada
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto enemy : enemies)
|
||||
{
|
||||
{// Actualiza los enemigos
|
||||
enemy->update();
|
||||
}
|
||||
|
||||
for (auto item : items)
|
||||
{
|
||||
{// Actualiza los items
|
||||
item->update();
|
||||
}
|
||||
}
|
||||
@@ -781,7 +787,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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,7 +796,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)
|
||||
@@ -832,7 +838,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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1122,4 +1128,16 @@ bool Room::checkRightSlopes(SDL_Point *p)
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Pone el mapa en modo pausa
|
||||
void Room::pause()
|
||||
{
|
||||
paused = true;
|
||||
}
|
||||
|
||||
// Quita el modo pausa del mapa
|
||||
void Room::resume()
|
||||
{
|
||||
paused = false;
|
||||
}
|
||||
Reference in New Issue
Block a user