- Created TITLE_SCREEN_CUSTOMIZATION.md with examples for extending the title screen. - Added TITLE_SCREEN_DEVELOPER_GUIDE.md for technical guidance on implementation. - Introduced TITLE_SCREEN_IMPLEMENTATION.md detailing the architecture and features. - Compiled TITLE_SCREEN_INDEX.md as a documentation index for easy navigation. - Updated TITLE_SCREEN_OVERLAY_UPDATE.md to reflect changes in title screen display mode. - Created TITLE_SCREEN_QUICK_START.md for a quick setup guide. - Developed TITLE_SCREEN_README.md as a comprehensive overview of the title screen system. - Added title-screen-demo.json scenario to demonstrate title screen functionality. - Modified existing files to integrate the title screen into the game flow.
3.7 KiB
Title Screen Minigame Implementation
Overview
A simple title screen minigame has been created to display before the main game loads. It shows a "BreakEscape" title with a loading indicator, then automatically closes when the next minigame (such as mission brief or dialog) starts.
Files Created/Modified
New Files
-
js/minigames/title-screen/title-screen-minigame.js- Main title screen minigame class
- Extends
MinigameScenebase class - Auto-closes after 3 seconds (configurable)
- Has a helper function
startTitleScreenMinigame()for easy access
-
css/title-screen.css- Styling for the title screen
- Features a green glowing "BreakEscape" title with pulse animation
- Displays "Loading..." with an animated dot effect
- Full-screen dark background overlay
-
scenarios/title-screen-demo.json- Example scenario with
showTitleScreen: trueflag - Demonstrates how to enable the title screen in scenarios
- Example scenario with
Modified Files
-
js/minigames/index.js- Added import for
TitleScreenMinigameclass - Registered the title screen as
'title-screen'minigame type - Added
startTitleScreenMinigameto global window object
- Added import for
-
js/core/game.js- Added title screen launch in the
create()function after camera setup - Checks
gameScenario.showTitleScreenflag (defaults to true, set to false to disable) - Hides canvas and inventory before showing title screen
- Canvas/inventory are restored when transitioning to next minigame
- Added title screen launch in the
-
js/minigames/framework/minigame-manager.js- Enhanced
startMinigame()to detect transitions from title screen - Automatically shows canvas when transitioning from title screen to another minigame
- Shows inventory container when exiting title screen
- Enhanced
Features
Title Screen Display
- Shows "BreakEscape" title in green with glow effect
- Displays "Educational Security Game" subtitle
- Shows "Loading..." with animated dots
- Full-screen dark background (no game visible behind it)
Auto-Close Behavior
- Automatically closes after 3 seconds if no other minigame starts
- Automatically closes when another minigame launches (e.g., mission brief)
- Can be customized via
autoCloseTimeoutparameter
Scenario Integration
Add to any scenario JSON to enable:
{
"showTitleScreen": true,
"scenario_brief": "Your mission...",
...
}
Or disable for a scenario:
{
"showTitleScreen": false,
...
}
Testing
To test the title screen:
- Navigate to
http://localhost:8000/index.html?scenario=title-screen-demo - You should see the title screen display immediately before the game loads
- The title screen will auto-close and display the mission brief
Or use the scenario selector at scenario_select.html and choose "title-screen-demo"
Future Enhancements
The title screen can be easily expanded with:
- Custom artwork/animations
- Story introduction text
- Button prompts ("Press to Continue")
- Progress/loading information
- Sound effects
- Custom colors/styling per scenario
Just modify the HTML generation in titleScreenMinigame.js init() method or extend the CSS.
How It Works
Execution Flow:
- Game preload phase loads all assets
- Game create() phase initializes rooms (but keeps canvas hidden during title screen launch)
- After camera is set up,
create()checksgameScenario.showTitleScreen - If true, canvas is hidden and title screen minigame starts
- Next minigame (mission brief, dialog, etc.) automatically closes title screen
- Canvas and inventory are shown when title screen closes
- Game loop continues normally with visible canvas
Key: The room exists and is ready, but rendering is hidden until after the title screen.