time_since_last_yf = 0;
}
+ if(time_since_last_bike >= 1 / static_cast<float>(data["game_constants"]["bikes_per_second"]))
+ {
+ bike = std::make_unique<Bike_enemy>(bike_texture, data["bike_enemy"]);
+ time_since_last_bike = 0;
+ }
enemy->update(context);
game_map->update(points, remaining_time);
- if (yf.size()>0)
+ if (yf != nullptr)
{
- for(unsigned int i {0}; i < yf.size(); ++i)
- {
- yf[i]->update(context);
- }
+ yf->update(context);
+ }
+ if(bike != nullptr)
+ {
+ bike->update(context);
}
+ if (gameover)
+ {
+ context.next_state = std::make_unique<GameOver_menu>();
+ gameover = false;
+ return;
+ }
+
}
void Game_state::render(sf::RenderWindow &window) const