Loading entities from the map file
If you recall from the section of this chapter that dealt with the issue of creating a map class, we haven't finished implementing the loading method fully, because we had no entities yet. With that no longer being the case, let's take a look at extending it:
} else if(type == "PLAYER"){ if (playerId != -1){ continue; } // Set up the player position here. playerId = entityMgr->Add(EntityType::Player); if (playerId < 0){ continue; } float playerX = 0; float playerY = 0; keystream >> playerX >> playerY; entityMgr->Find(playerId)->SetPosition(playerX,playerY); m_playerStart = sf::Vector2f(playerX, playerY); } else if(type == "ENEMY"){ std::string enemyName; keystream >> enemyName; int enemyId = entityMgr->Add(EntityType::Enemy, enemyName); if (enemyId < 0){ continue; } float enemyX = 0; float enemyY = 0; keystream >> enemyX >> enemyY; entityMgr->Find(enemyId)->SetPosition(enemyX...