Extending the Game
Where to add new object types, block types, game phases, and sounds.
Adding a New Object Type
See the full walkthrough in Tutorial: Adding a New Game Object. Summary:
- Append enum value to
include/GalaxyEggbert/def/ObjectType.hpp(IDs above 203 are safe for new types). - Add icon mapping case in
Decor::GetIcon(). - Add contact behaviour in
Decor::Update() → CheckContact(). - Optionally add a new event flag in
Decor(e.g.,newEvent_) and consume it inGalaxyEggbertGame::UpdatePlay().
Adding a New Block Type
-
Add a named constant in
include/GalaxyEggbert/BlockTypes.hpp:static constexpr uint16_t MyBlock = <icon-index-in-object-m.png>; -
If the block should be passable (decorative, not collidable), add its ID to the
isMobileTransparent()lookup table inBlockTypes.hpp. -
If the block originates from mobile-eggbert
.txtlevels, add a mapping inBlockTypes::fromMobileIconId(). -
The terrain node spawner (
SpawnTerrainNodes()) and material cache (GetTileMaterial()) work automatically for any non-zero block type ID.
Adding a New Game Phase
- Add the value to
include/GalaxyEggbert/def/GamePhase.hpp. - Add an
UpdateXxx(dt)method toGalaxyEggbertGame. - Add a dispatch case in
GalaxyEggbertGame::Update(dt):case GamePhase::MyPhase: UpdateMyPhase(dt); break; - Trigger it via
EnterPhase(GamePhase::MyPhase)from the appropriate event handler.
Adding a New Sound
- Place the WAV file at
Content/Data/Sound/sound0NN.wavwith the next available index. - Add the enum value to
include/GalaxyEggbert/def/SoundChannel.hpp:SoundChannelNN = NN, - Update
SoundManager::kNumChannelsif needed. - Call
sound_->Play(SoundChannel::SoundChannelNN)from the appropriate location.
Adding a New World
- Increment
kMaxWorldinGalaxyEggbertGame. - Add
Content/Data/Level/scene06.txt(or.vwr). - Update
GameDatadoor count if new doors are added.
World count is currently 5 (
kMaxWorld = 5). Adding world 6+ requires
verifying the GameData door-slot layout stays within the 210-byte per-gamer record.