feat: place towers

This commit is contained in:
2021-09-19 19:20:08 +02:00
parent 3f53d32e44
commit 10a1fac992
6 changed files with 69 additions and 18 deletions

View File

@@ -299,7 +299,7 @@ bool World::loadMapFromFile(const std::string& fileName) {
m_Chunks.insert({ {3, 0}, std::make_shared<Chunk>(chunk11) });
m_Chunks.insert({ {3, 1}, std::make_shared<Chunk>(chunk21) });
return saveMap("tdmap_linux.tdmap");
return saveMap("tdmap_debug.tdmap");
#endif
}
@@ -334,6 +334,11 @@ void World::spawnMobAt(MobID id, MobType type, std::uint8_t level, PlayerID send
m_Mobs.push_back(mob);
}
void World::placeTowerAt(TowerType type, std::int32_t x, std::int32_t y, PlayerID builder) {
TowerPtr tower = TowerFactory::createTower(type, x, y, builder);
m_Towers.push_back(tower);
}
void World::moveMobs(std::uint64_t delta) {
for (MobPtr mob : m_Mobs) {
TilePtr tile = getTile(mob->getX(), mob->getY());