forked from jaildesigner-jailgames/jaildoctors_dilemma
AHORA SI: Colisiones finalizadas
This commit is contained in:
@@ -107,13 +107,11 @@ bool Room::load(std::string _file_path)
|
||||
// Si la linea contiene el texto [tilemap] se realiza el proceso de carga del fichero tmx
|
||||
else if (line == "[tilemap]")
|
||||
{
|
||||
// printf("Loading tilemap...\n");
|
||||
do
|
||||
{
|
||||
std::getline(file, line);
|
||||
if (line.find(".tmx") != std::string::npos)
|
||||
{
|
||||
// printf("Reading file %s\n", asset->get(line).c_str());
|
||||
std::ifstream file2(asset->get(line)); // Abre el fichero tmx
|
||||
if (file2.good())
|
||||
{
|
||||
@@ -126,11 +124,7 @@ bool Room::load(std::string _file_path)
|
||||
do
|
||||
{
|
||||
std::getline(file2, line);
|
||||
// printf("parsing: %s\n", line.c_str());
|
||||
|
||||
pos = line.find("data encoding");
|
||||
// printf("pos: %i\n", pos);
|
||||
|
||||
} while (pos == std::string::npos);
|
||||
|
||||
do
|
||||
@@ -139,12 +133,10 @@ bool Room::load(std::string _file_path)
|
||||
std::getline(file2, line);
|
||||
if (line != "</data>")
|
||||
{
|
||||
// printf("data: %s\n", line.c_str());
|
||||
std::stringstream ss(line);
|
||||
std::string tmp;
|
||||
while (getline(ss, tmp, ','))
|
||||
{
|
||||
// printf("tile: %s\n", tmp.c_str());
|
||||
tilemap.push_back(std::stoi(tmp));
|
||||
}
|
||||
}
|
||||
@@ -444,7 +436,7 @@ void Room::fillMapTexture()
|
||||
{
|
||||
clip.x = x * 8;
|
||||
clip.y = y * 8;
|
||||
SDL_SetRenderDrawColor(renderer, 48, 48, 48, 224);
|
||||
SDL_SetRenderDrawColor(renderer, 64, 64, 64, 224);
|
||||
SDL_RenderFillRect(renderer, &clip);
|
||||
}
|
||||
}
|
||||
@@ -702,25 +694,21 @@ int Room::getSlopeHeight(SDL_Point p, tile_e slope)
|
||||
{
|
||||
// Calcula la base del tile
|
||||
int base = ((p.y / tileSize) * tileSize) + tileSize;
|
||||
printf("base %i\n", base);
|
||||
debug->add("BASE = " + std::to_string(base));
|
||||
|
||||
// Calcula cuanto se ha entrado en el tile horizontalmente
|
||||
const int pos = (p.x % tileSize); // esto da un valor entre 0 y 7
|
||||
printf("pos %i\n", base);
|
||||
debug->add("POS = " + std::to_string(pos));
|
||||
|
||||
// Se resta a la base la cantidad de pixeles pos en funcion de la rampa
|
||||
if (slope == t_slope_r)
|
||||
{
|
||||
base -= pos + 1;
|
||||
printf("base_R %i\n", base);
|
||||
debug->add("BASE_R = " + std::to_string(base));
|
||||
}
|
||||
else
|
||||
{
|
||||
base -= (tileSize - pos);
|
||||
printf("base_L %i\n", base);
|
||||
debug->add("BASE_L = " + std::to_string(base));
|
||||
}
|
||||
|
||||
@@ -876,6 +864,7 @@ void Room::setRightSurfaces()
|
||||
}
|
||||
line.y2 = ((tile[i] / mapWidth) * tileSize) + tileSize - 1;
|
||||
rightSurfaces.push_back(line);
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user