game_map{},
pause_game{false},
player{},
- bottles{},
- main_enemy_texture{},
+ bottles{},
+ helper{},
++ main_enemy_texture{},
time_since_last_bottle{0.0f},
bottle_texture {},
data{},
player = std::make_unique<Player>(data["player"]);
helper = std::make_unique<Helper>(data["helper"]);
+ game_map = std::make_unique<Map>(data["map"]);
+ enemy = std::make_unique<Main_enemy>(main_enemy_texture, data["main_enemy"]);
bottle_texture.loadFromFile("assets/kir.png");
+
}
void Game_state::update(Context &context)
std::cout << "placed bottle"<< std::endl;
time_since_last_bottle = 0;
}
- game_map.update(context);
+ game_map->update(points);
- enemy.update(context);
+ player->update(context);
+ helper->update(context);
+ enemy->update(context);
}
void Game_state::render(sf::RenderWindow &window) const
{
- game_map.render(window);
+ game_map->render(window);
player->render(window);
- enemy.render(window);
+ enemy->render(window);
helper->render(window);
for (int i{}; i < int(bottles.size()); ++i)
{
private:
float time_since_last_bottle;
- Map game_map;
+ std::unique_ptr<Map> game_map;
std::unique_ptr<Player> player;
std::unique_ptr<Helper> helper;
- Main_enemy enemy;
+ std::unique_ptr<Main_enemy> enemy;
+
bool pause_game;
sf::Texture bottle_texture;
+ sf::Texture main_enemy_texture;
json data;
+ int points;
};