forked from jaildesigner-jailgames/jaildoctors_dilemma
Actualizadas las clases sprite, movingsprite y animatedsprite
This commit is contained in:
@@ -85,7 +85,7 @@ bool Room::load(std::string _file_path)
|
||||
printf("Warning: file %s\n, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
||||
success = false;
|
||||
}
|
||||
} while (line != "[enemy-end]");
|
||||
} while (line != "[/enemy]");
|
||||
|
||||
// Añade el enemigo al vector de enemigos
|
||||
enemies.push_back(new Enemy(enemy));
|
||||
@@ -140,7 +140,7 @@ bool Room::load(std::string _file_path)
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (line != "[tilemap-end]");
|
||||
} while (line != "[/tilemap]");
|
||||
}
|
||||
|
||||
// Si la linea contiene el texto [item] se realiza el proceso de carga de un item
|
||||
@@ -162,7 +162,7 @@ bool Room::load(std::string _file_path)
|
||||
printf("Warning: file %s\n, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
||||
success = false;
|
||||
}
|
||||
} while (line != "[item-end]");
|
||||
} while (line != "[/item]");
|
||||
|
||||
// Añade el item al vector de items
|
||||
const SDL_Point itemPos = {item.x, item.y};
|
||||
@@ -265,53 +265,71 @@ bool Room::setEnemy(enemy_t *enemy, std::string var, std::string value)
|
||||
{
|
||||
enemy->tileset = value;
|
||||
}
|
||||
|
||||
else if (var == "animation")
|
||||
{
|
||||
enemy->animation = value;
|
||||
}
|
||||
|
||||
else if (var == "width")
|
||||
{
|
||||
enemy->w = std::stof(value);
|
||||
}
|
||||
|
||||
else if (var == "height")
|
||||
{
|
||||
enemy->h = std::stof(value);
|
||||
}
|
||||
|
||||
else if (var == "x")
|
||||
{
|
||||
enemy->x = std::stof(value) * BLOCK;
|
||||
}
|
||||
|
||||
else if (var == "y")
|
||||
{
|
||||
enemy->y = std::stof(value) * BLOCK;
|
||||
}
|
||||
|
||||
else if (var == "vx")
|
||||
{
|
||||
enemy->vx = std::stof(value);
|
||||
}
|
||||
|
||||
else if (var == "vy")
|
||||
{
|
||||
enemy->vy = std::stof(value);
|
||||
}
|
||||
|
||||
else if (var == "x1")
|
||||
{
|
||||
enemy->x1 = std::stoi(value) * BLOCK;
|
||||
}
|
||||
|
||||
else if (var == "x2")
|
||||
{
|
||||
enemy->x2 = std::stoi(value) * BLOCK;
|
||||
}
|
||||
|
||||
else if (var == "y1")
|
||||
{
|
||||
enemy->y1 = std::stoi(value) * BLOCK;
|
||||
}
|
||||
|
||||
else if (var == "y2")
|
||||
{
|
||||
enemy->y2 = std::stoi(value) * BLOCK;
|
||||
}
|
||||
|
||||
else if (var == "color")
|
||||
{
|
||||
enemy->color = stringToColor(value);
|
||||
}
|
||||
else if (var == "[enemy-end]")
|
||||
|
||||
else if (var == "[/enemy]")
|
||||
{
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
success = false;
|
||||
@@ -330,21 +348,26 @@ bool Room::setItem(item_t *item, std::string var, std::string value)
|
||||
{
|
||||
item->tileset = value;
|
||||
}
|
||||
|
||||
else if (var == "x")
|
||||
{
|
||||
item->x = std::stof(value) * BLOCK;
|
||||
}
|
||||
|
||||
else if (var == "y")
|
||||
{
|
||||
item->y = std::stof(value) * BLOCK;
|
||||
}
|
||||
|
||||
else if (var == "tile")
|
||||
{
|
||||
item->tile = std::stof(value);
|
||||
}
|
||||
else if (var == "[item-end]")
|
||||
|
||||
else if (var == "[/item]")
|
||||
{
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
success = false;
|
||||
|
||||
Reference in New Issue
Block a user