Ya detecta las plataformas móviles bajo los pies
This commit is contained in:
@@ -502,5 +502,32 @@ int Map::actorCollision(SDL_Rect &rect)
|
||||
index++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Indica si hay colision con un actor a partir de un rectangulo
|
||||
int Map::actorCollision(SDL_Point &p)
|
||||
{
|
||||
int index = 0;
|
||||
for (auto actor : actors)
|
||||
{
|
||||
if (checkCollision(p, actor->getCollider()))
|
||||
{
|
||||
return index;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Devuelve el nombre del actor a pàrtir de un índice
|
||||
int Map::getActorName(int index)
|
||||
{
|
||||
if (index != -1)
|
||||
{
|
||||
return actors[index]->getName();
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
Reference in New Issue
Block a user