Hello everyone. I am using the TMX Map Loader to load the .tmx files from the Tiled Map Editor. In the documentation they have a section covering collision detection with this snippet of code:
bool collision;
for(auto layer = mll.GetLayers().begin(); layer != mll.GetLayers().end(); ++layer)
{
if(layer->name == "Test")
{
for(auto object = layer->objects.begin(); object != layer->objects.end(); ++object)
{
collision = object->Contains(point);
}
}
}
For the line
collision = object->Contains(point);
, am I right to use something along the lines of animatedSprite.getPosition() in place of point? Also, when I try to use that code to determine whether or not Collision is true or false, it is always true. For example, if I make a move condition for my sprite stating that they can move if collision is false, else they cannot move, they will never be able to move.
I'm sure this didn't come out as clearly as it sounded in my head. Any help with this would be greatly appreciated!