1#ifndef _BOMBERMAN_LEVEL_SCENE_H_
2#define _BOMBERMAN_LEVEL_SCENE_H_
9#include "Entities/Music.h"
10#include "Entities/Player.h"
11#include "Scenes/Scene.h"
38 LevelScene(
Game* game,
const unsigned int stage,
const unsigned int prevScore,
39 std::optional<uint32_t> mapSeed = std::nullopt);
50 return { fieldPositionX, fieldPositionY, scaledTileSize };
58 virtual void onEvent(
const SDL_Event& event)
override;
64 virtual void update(
const unsigned int delta)
override;
82 void generateTileMap(std::optional<uint32_t> mapSeed);
83 void spawnGrass(
const int positionX,
const int positionY);
84 void spawnBrick(
const int positionX,
const int positionY);
85 void spawnStone(
const int positionX,
const int positionY);
86 void spawnPlayer(
const int positionX,
const int positionY);
92 void updateMovement(
const bool isPressed,
const int keycode);
123 std::shared_ptr<Music> menuMusic =
nullptr;
124 std::shared_ptr<Player> player =
nullptr;
127 int playerDirectionX = 0;
128 int playerDirectionY = 0;
129 bool isPaused =
false;
130 unsigned int stage = 0;
133 int fieldPositionX = 0;
134 int fieldPositionY = 0;
136 int scaledTileSize = 0;
138 int backgroundObjectLastNumber = 0;
Game-world configuration constants.
constexpr unsigned int tileArrayWidth
Tile map width in tiles.
Definition Const.h:43
constexpr unsigned int tileArrayHeight
Tile map height in tiles.
Definition Const.h:44
Tile
Tile type identifiers used in the tile map.
Definition Const.h:13
Shared authoritative movement simulation primitives.
Shared level-scene scaffold used by both singleplayer and multiplayer.
Definition LevelScene.h:20
void setLocalPlayerPositionQ(sim::TilePos posQ)
Replaces the canonical local player position and syncs the sprite immediately.
Definition LevelScene.cpp:297
virtual void onCollisionObjectSpawned(Tile tile, const std::shared_ptr< Object > &object)
Allows derived scenes to collect collision objects during map spawn.
Definition LevelScene.cpp:115
virtual bool supportsPause() const
Whether ENTER pause toggle is enabled for this level mode.
Definition LevelScene.h:108
FieldTransform getFieldTransform() const
Returns the field transform needed to map tile-Q8 world coords to screen pixels.
Definition LevelScene.h:48
virtual void onEvent(const SDL_Event &event) override
Catch SDL2 events.
Definition LevelScene.cpp:127
virtual void updateLevel(const unsigned int delta)=0
Per-mode update body executed when the scene is not paused.
void clearLocalMovementInput()
Clears locally held movement input and resets player facing/animation state.
Definition LevelScene.cpp:263
void onEnter() override
Called when scene become activated.
Definition LevelScene.cpp:26
virtual bool usesEventDrivenLocalMovement() const
Returns true when this level consumes SDL key press/release events as local movement state.
Definition LevelScene.h:75
virtual void onKeyPressed(SDL_Scancode scancode)
Optional per-mode key-down handling.
Definition LevelScene.cpp:165
void stepLocalPlayerMovement()
Steps the local player position by one simulation tick.
Definition LevelScene.cpp:272
void syncPlayerSpriteToSimPosition()
Writes playerPos_ to the player sprite in screen space.
Definition LevelScene.cpp:287
void initializeLevelWorld(std::optional< uint32_t > mapSeed)
Completes shared world setup after derived state is ready.
Definition LevelScene.cpp:46
void onExit() override
CAlled when scene become deactivated.
Definition LevelScene.cpp:36
virtual void update(const unsigned int delta) override
Update level scene.
Definition LevelScene.cpp:157
sim::TilePos playerPos_
Canonical player position in tile-Q8, owned by LevelScene.
Definition LevelScene.h:141
Scene base class.
Definition Scene.h:17
Tile-space Q8 position representing the CENTER of the entity.
Definition Movement.h:30