feat: level intro camera overview#2
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a level-start “cinematic” camera intro that pans from the player spawn to the goal flag and back, freezing gameplay until the sequence completes.
Changes:
- Introduces an intro-phase state machine in
GameSceneto pan/zoom the camera and delay player control. - Blocks coin pickups during the intro phase to avoid accidental collection.
- Moves camera follow activation out of
buildLevelFromGraphand intoGameScene(after the intro), and adds configurable timing/zoom constants toGameConfig.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/config/GameConfig.ts |
Adds named constants for intro pan/pause/return timings and zoom. |
src/levels/buildLevelFromGraph.ts |
Removes immediate camera.startFollow() so following can be delayed until after the intro. |
src/scenes/GameScene.ts |
Implements intro-phase camera pan/zoom, freezes player, blocks coin collection, and starts camera follow after intro completes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| this.goalX = built.flag.x; | ||
| this.goalY = built.flag.y; | ||
| this.introPhase = 'pan-out'; | ||
| this.introElapsed = 0; | ||
| this.player.arcadeBody.setAllowGravity(false); | ||
| this.player.arcadeBody.setVelocity(0, 0); | ||
| const cam = this.cameras.main; | ||
| cam.centerOn(this.spawnX, this.spawnY); | ||
| cam.pan(this.goalX, this.goalY, INTRO_PAN_OUT_MS, 'Sine.easeInOut'); | ||
| cam.zoomTo(INTRO_ZOOM_OUT, INTRO_PAN_OUT_MS, 'Sine.easeInOut'); | ||
|
|
There was a problem hiding this comment.
Done in ccc94a4. Added GameScene.introPhase.test.ts with 25 tests covering all three requested areas:
- Coin overlap blocked during intro — tests verify the
introPhase !== "done"guard rejects coins in all three pre-done phases and allows collection once done. - Camera follow + gravity enabled at intro end — tests verify
player.unfreeze()andcameraFollowingare set exactly whenintroPhasetransitions to"done", including boundary ticks. - Death during intro — tests document the original bug (death poll unreachable while intro returns early) and verify the fix:
player.deadis now checked before the intro early-return, sohandleDeathfires after the 600 ms accumulation even while the camera pan is still running.
Two companion code fixes were also included: Jacobot bug damage is blocked during the intro (new introPhase !== "done" guard on the overlap callback), and arcadeBody.setAllowGravity(true) at intro end was replaced with player.unfreeze() for consistency with freeze() in create().
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Move player.dead poll before intro early-return in update() so deaths triggered during the intro (e.g. fire ground) are handled correctly - Add introPhase !== 'done' guard to Jacobot bug overlap callback so Jacobot cannot damage the frozen player during the camera intro - Use player.unfreeze() instead of direct arcadeBody.setAllowGravity(true) for consistency with the freeze() call in create() - Normalise single-quoted string literals to double quotes in intro code - Add GameScene.introPhase.test.ts with 25 regression tests covering: (1) coin overlap blocked during every intro phase (2) intro state machine timing and phase transitions (3) player.unfreeze() + camera follow enabled exactly at intro end (4) death polled and handleDeath triggered during intro (fix regression)" Agent-Logs-Url: https://github.com/DynamoDS/DynoDashGame/sessions/b3acf55e-e3c3-48f3-9c0e-4749293c972f Co-authored-by: QilongTang <3942418+QilongTang@users.noreply.github.com>
Summary
Adds a cinematic camera pan at the start of each level that gives players a quick preview of the goal before gameplay begins.
startFollowre-enable the moment the intro completesGameConfig.ts(INTRO_PAN_OUT_MS,INTRO_PAUSE_MS,INTRO_RETURN_MS,INTRO_ZOOM_OUT) for easy tuningcamera.startFollow()out ofbuildLevelFromGraphand intoGameSceneso it only activates after the intro finishesFiles changed
src/config/GameConfig.tssrc/levels/buildLevelFromGraph.tsstartFollowcallsrc/scenes/GameScene.tsintroPhasestate machine + intro update loopTest plan
INTRO_ZOOM_OUTinGameConfig.tsto verify config drives the behavior🤖 Generated with Claude Code