24 SingleplayerLevelScene(
Game* game,
unsigned int stage,
unsigned int prevScore, std::optional<uint32_t> mapSeed = std::nullopt);
27 virtual void updateLevel(
unsigned int delta)
override;
28 virtual void onKeyPressed(SDL_Scancode scancode)
override;
31 void spawnTextObjects();
33 void setTimerTextFromMilliseconds(
int milliseconds);
34 void generateEnemies();
35 void spawnEnemy(Texture texture, AIType type,
int positionX,
int positionY);
36 void spawnBomb(
Object*
object);
37 void spawnBang(
Object*
object);
38 void spawnDoor(
Object*
object);
43 void updateTimers(
unsigned int delta);
44 void updateBombTimer(
unsigned int delta);
45 void updateBangTimer(
unsigned int delta);
46 void updateGameOverTimer(
unsigned int delta);
48 void updatePlayerCollision();
49 void updateEnemiesCollision();
50 void updateBangsCollision();
51 [[nodiscard]]
bool isCollisionDetected(
const SDL_FRect& rect1,
const SDL_FRect& rect2)
const;
52 void destroyBrick(std::shared_ptr<Object> brick);
53 void followToPlayer(
Enemy* enemy);
54 virtual void onCollisionObjectSpawned(
Tile tile,
const std::shared_ptr<Object>&
object)
override;
56 static constexpr int kLevelTimerStart = 200500;
57 static constexpr int kLevelTimerUpdateText = 1000;
58 static constexpr int kBombTimerStart = 1500;
59 static constexpr int kBangTimerStart = 800;
60 static constexpr int kGameOverTimerStart = 1000;
61 static constexpr int kWinTimerStart = 200;
63 static constexpr unsigned int kScoreRewardForKill = 200;
64 static constexpr unsigned int kScoreRewardForStage = 1000;
66 std::shared_ptr<Sound> gameoverSound =
nullptr;
67 std::shared_ptr<Sound> winSound =
nullptr;
68 std::shared_ptr<Sound> explosionSound =
nullptr;
69 std::shared_ptr<Text> timerLabel =
nullptr;
70 std::shared_ptr<Text> timerNumber =
nullptr;
71 std::shared_ptr<Text> scoreNumber =
nullptr;
72 std::shared_ptr<Text> stageLabel =
nullptr;
73 std::shared_ptr<Sprite> bomb =
nullptr;
74 std::shared_ptr<Sprite> door =
nullptr;
75 std::vector<std::shared_ptr<Enemy>> enemies;
76 std::vector<std::pair<Tile, std::shared_ptr<Object>>> collisions;
77 std::vector<std::shared_ptr<Object>> bangs;
79 unsigned int score = 0;
80 int levelTimer = kLevelTimerStart;
81 int levelTimerDelta = 0;
84 int gameOverTimer = 0;
86 bool isGameOver =
false;