bool Map::test_collision_with_obstacles(int x, int y, MapEntity& check_entity) { bool collision; // test tiles collision = test_collision_with_tiles(x, y, check_entity); // test entities if(!collision) { Rectangle collision_box(x, y, 1, 1); collision = test_collision_with_entities(collision_box, check_entity); } return collision; }
/** * \brief Tests whether a point collides with the map obstacles. * \param layer Layer of point to check. * \param x X coordinate of the point to check. * \param y Y coordinate of the point to check. * \param entity_to_check The entity to check (used to decide what is * considered as obstacle) * \return \c true if the point is overlapping an obstacle. */ bool Map::test_collision_with_obstacles( Layer layer, int x, int y, const MapEntity& entity_to_check) const { bool collision; bool is_diagonal_wall; // Test the terrain. collision = test_collision_with_ground(layer, x, y, entity_to_check, is_diagonal_wall); // Test the dynamic entities. if (!collision) { Rectangle collision_box(x, y, 1, 1); collision = test_collision_with_entities(layer, collision_box, entity_to_check); } return collision; }