Retocados nombres de variables antiguos
This commit is contained in:
@@ -116,6 +116,7 @@ bool Map::load(std::string file_path)
|
||||
actor_t actor;
|
||||
actor.asset = asset;
|
||||
actor.renderer = renderer;
|
||||
actor.name = a_moving_platform;
|
||||
SDL_Point p1, p2;
|
||||
|
||||
do
|
||||
@@ -266,11 +267,11 @@ bool Map::setActor(actor_t *actor, SDL_Point *p1, SDL_Point *p2, std::string var
|
||||
}
|
||||
else if (var == "width")
|
||||
{
|
||||
actor->w = std::stof(value);
|
||||
actor->w = std::stoi(value);
|
||||
}
|
||||
else if (var == "height")
|
||||
{
|
||||
actor->h = std::stof(value);
|
||||
actor->h = std::stoi(value);
|
||||
}
|
||||
else if (var == "x")
|
||||
{
|
||||
@@ -486,4 +487,20 @@ std::string Map::getRoomFileName(e_border border)
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
// Indica si hay colision con un actor a partir de un rectangulo
|
||||
int Map::actorCollision(SDL_Rect &rect)
|
||||
{
|
||||
int index = 0;
|
||||
for (auto actor : actors)
|
||||
{
|
||||
if (checkCollision(rect, actor->getCollider()))
|
||||
{
|
||||
return index;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
Reference in New Issue
Block a user