Ya coge los diamantes, aunque no los recuerda
This commit is contained in:
@@ -135,10 +135,40 @@ bool Map::load(std::string file_path)
|
||||
|
||||
} while (line != "[/moving platform]");
|
||||
|
||||
printf("actor loaded\n");
|
||||
printf("** actor moving platform loaded\n");
|
||||
actors.push_back(new ActorMovingPlatform(actor, p1, p2));
|
||||
}
|
||||
|
||||
if (line == "[diamond]")
|
||||
{
|
||||
actor_t actor;
|
||||
actor.asset = asset;
|
||||
actor.renderer = renderer;
|
||||
actor.name = a_diamond;
|
||||
actor.vx = 0.0f;
|
||||
actor.vy = 0.0f;
|
||||
SDL_Point p1, p2;
|
||||
|
||||
do
|
||||
{
|
||||
std::getline(file, line);
|
||||
|
||||
// Encuentra la posición del caracter '='
|
||||
int pos = line.find("=");
|
||||
|
||||
// Procesa las dos subcadenas
|
||||
if (!setActor(&actor, &p1, &p2, line.substr(0, pos), line.substr(pos + 1, line.length())))
|
||||
{
|
||||
printf("Warning: file %s\n, unknown parameter \"%s\"\n", filename.c_str(), line.substr(0, pos).c_str());
|
||||
success = false;
|
||||
}
|
||||
|
||||
} while (line != "[/diamond]");
|
||||
|
||||
printf("** actor diamond loaded\n");
|
||||
actors.push_back(new ActorDiamond(actor));
|
||||
}
|
||||
|
||||
} while (line != "[/actors]");
|
||||
/*actor_t actor;
|
||||
actor.asset = asset;
|
||||
@@ -305,7 +335,7 @@ bool Map::setActor(actor_t *actor, SDL_Point *p1, SDL_Point *p2, std::string var
|
||||
{
|
||||
p2->y = std::stoi(value) * tile_size;
|
||||
}
|
||||
else if (var == "[/moving platform]")
|
||||
else if ((var == "[/moving platform]") || (var == "[/diamond]"))
|
||||
{
|
||||
}
|
||||
else
|
||||
@@ -554,4 +584,18 @@ int Map::getActorIncX(int index)
|
||||
}
|
||||
|
||||
return shift;
|
||||
}
|
||||
|
||||
// Elimina un actor
|
||||
bool Map::deleteActor(int index)
|
||||
{
|
||||
bool success = false;
|
||||
if (actors[index] != nullptr)
|
||||
{
|
||||
delete actors[index];
|
||||
success = true;
|
||||
}
|
||||
|
||||
actors.erase(actors.begin() + index);
|
||||
return success;
|
||||
}
|
||||
Reference in New Issue
Block a user