bool LevelReaderWriter::SaveAsTextV0(const std::string& _filePath, const Player& _player, const std::vector<Box>& _boxes,
  const std::vector<Box>& _obstacles, const std::vector<Coins>& _coins, const Box& _exit, const Box& _trigger,
  const std::vector<Light>& _lights, const std::vector<EnemyRobot>& _enemies)
{
  std::ofstream file(_filePath);
  if (file.fail())
  {
    perror(_filePath.c_str());
    return false;
  }

  //write version
  file << TEXT_VERSION << "\n";
  //write player
  file << _player.GetPosition().x << ' ' << _player.GetPosition().y << ' '
    << _player.GetDrawDims().x << ' ' << _player.GetDrawDims().y << ' '
    << _player.GetColDims().x << ' ' << _player.GetColDims().y << ' '
    << _player.GetColor().r << ' ' << _player.GetColor().g << ' '
    << _player.GetColor().b << ' ' << _player.GetColor().a << '\n';

  //write the exit
  file << _exit.GetPosition().x << ' ' << _exit.GetPosition().y << ' '
    << _exit.GetDimensions().x << ' ' << _exit.GetDimensions().y << ' '
    << _exit.GetColor().r << ' ' << _exit.GetColor().g << ' '
    << _exit.GetColor().b << ' ' << _exit.GetColor().a << ' '
    << _exit.GetUvRect().x << ' ' << _exit.GetUvRect().y << ' '
    << _exit.GetUvRect().z << ' ' << _exit.GetUvRect().w << ' '
    << _exit.GetAngle() << ' ' << _exit.GetTexture().filePath << ' '
    << _exit.GetIsDynamic() << ' ' << _exit.GetFixedRotation() << ' '
    << _exit.GetIsSensor() << '\n';

  //write the trigger(switch)
  file << _trigger.GetPosition().x << ' ' << _trigger.GetPosition().y << ' '
    << _trigger.GetDimensions().x << ' ' << _trigger.GetDimensions().y << ' '
    << _trigger.GetColor().r << ' ' << _trigger.GetColor().g << ' '
    << _trigger.GetColor().b << ' ' << _trigger.GetColor().a << ' '
    << _trigger.GetUvRect().x << ' ' << _trigger.GetUvRect().y << ' '
    << _trigger.GetUvRect().z << ' ' << _trigger.GetUvRect().w << ' '
    << _trigger.GetAngle() << ' ' << _trigger.GetTexture().filePath << ' '
    << _trigger.GetIsDynamic() << ' ' << _trigger.GetFixedRotation() << ' '
    << _trigger.GetIsSensor() << '\n';

  //write the number of boxes
  file << _boxes.size() << "\n";

  //write all the boxes
  for (auto& b : _boxes)
  {
    file << b.GetPosition().x << ' ' << b.GetPosition().y << ' '
      << b.GetDimensions().x << ' ' << b.GetDimensions().y << ' '
      << b.GetColor().r << ' ' << b.GetColor().g << ' '
      << b.GetColor().b << ' ' << b.GetColor().a << ' '
      << b.GetUvRect().x << ' ' << b.GetUvRect().y << ' '
      << b.GetUvRect().z << ' ' << b.GetUvRect().w << ' '
      << b.GetAngle() << ' ' << b.GetTexture().filePath << ' '
      << b.GetIsDynamic() << ' ' << b.GetFixedRotation() << ' '
      << b.GetIsSensor() << '\n';
  }

  //write the number of obstacles
  file << _obstacles.size() << "\n";
  //write all the obstacles
  for (auto& obs : _obstacles)
  {
    file << obs.GetPosition().x << ' ' << obs.GetPosition().y << ' '
      << obs.GetDimensions().x << ' ' << obs.GetDimensions().y << ' '
      << obs.GetColor().r << ' ' << obs.GetColor().g << ' '
      << obs.GetColor().b << ' ' << obs.GetColor().a << ' '
      << obs.GetUvRect().x << ' ' << obs.GetUvRect().y << ' '
      << obs.GetUvRect().z << ' ' << obs.GetUvRect().w << ' '
      << obs.GetAngle() << ' ' << obs.GetTexture().filePath << ' '
      << obs.GetIsDynamic() << ' ' << obs.GetFixedRotation() << ' '
      << obs.GetIsSensor() << '\n';
  }

  //write the number of lights
  file << _lights.size() << "\n";
  for (auto& light : _lights)
  {
    file << light.position.x << ' ' << light.position.y << ' ' << light.size << ' ' <<
      light.color.r << ' ' << light.color.g << ' ' << light.color.b << ' ' << light.color.a << '\n';
  }

  //write the number of enemies
  file << _enemies.size() << "\n";
  for (auto& enemy : _enemies)
  {
    //write player
    file << enemy.GetPosition().x << ' ' << enemy.GetPosition().y << ' '
      << enemy.GetDrawDims().x << ' ' << enemy.GetDrawDims().y << ' '
      << enemy.GetColDims().x << ' ' << enemy.GetColDims().y << ' '
      << enemy.GetColor().r << ' ' << enemy.GetColor().g << ' '
      << enemy.GetColor().b << ' ' << enemy.GetColor().a << '\n';
  }

  //write the number of obstacles
  file << _coins.size() << "\n";
  //write all the obstacles
  for (auto& coin : _coins)
  {
    file << coin.GetPosition().x << ' ' << coin.GetPosition().y << ' '
      << coin.GetDimensions().x << ' ' << coin.GetDimensions().y << ' '
      << coin.GetColor().r << ' ' << coin.GetColor().g << ' '
      << coin.GetColor().b << ' ' << coin.GetColor().a << ' ' << '\n';
  }
  file.close();
  return true;
}