Skip to content

Examples: give the Ground Shadows scene a stage of its own - #1716

Merged
obiot merged 1 commit into
masterfrom
fix/ground-shadows-stage
Oct 6, 2026
Merged

obiot merged 1 commit into
masterfrom
fix/ground-shadows-stage

Conversation

@obiot

@obiot obiot commented Oct 6, 2026

Copy link
Copy Markdown
Member

loader.preload() switches to state.LOADING, and that stage is
transitional. The example built its scene in the preload callback and then
called state.change(state.DEFAULT) to get out of it, which the scenes skill
describes as the fallback you take when you will not write a stage:

If you genuinely want to keep using the loading stage as your scene,
state.change(state.DEFAULT) at least gets you out of it, but a stage of
your own is what you want.

Taking the documented second-best in a reference example teaches it. 34 of
this repo's examples register a PLAY stage; this is now one of them.

The scene is built in onResetEvent, the per-frame work moved from a
Renderable that drew nothing into the stage's own update, and the pointer
handlers and the DOM panel are released in onDestroyEvent rather than from a
teardown closure the engine knows nothing about. The asset list is lifted into
a resources const so the tail reads as "load, then switch".

Also fixes a type error in jungleRabbit/scenery.ts: a boolean does not
narrow normal/groundY at the spread site under
exactOptionalPropertyTypes, and it never checked groundY at all. The
condition is written out in full, as GameStage.addScatter already does.

Verified at runtime: DefaultLoadingScreen while the assets load, then
GroundShadowsStage with isLoading false, and the sun still turning.
🤖 Generated with Claude Code

https://claude.ai/code/session_01NGvtaUNATVCVxD2qcbiY4t

`loader.preload()` switches to `state.LOADING`, and that stage is
transitional. The example built its scene in the preload callback and then
called `state.change(state.DEFAULT)` to get out of it, which the scenes skill
describes as the fallback you take when you will not write a stage:

> If you genuinely want to keep using the loading stage as your scene,
> `state.change(state.DEFAULT)` at least gets you out of it, but a stage of
> your own is what you want.

Taking the documented second-best in a reference example teaches it. 34 of
this repo's examples register a `PLAY` stage; this is now one of them.

The scene is built in `onResetEvent`, the per-frame work moved from a
`Renderable` that drew nothing into the stage's own `update`, and the pointer
handlers and the DOM panel are released in `onDestroyEvent` rather than from a
teardown closure the engine knows nothing about. The asset list is lifted into
a `resources` const so the tail reads as "load, then switch".

Also fixes a type error in `jungleRabbit/scenery.ts`: a boolean does not
narrow `normal`/`groundY` at the spread site under
`exactOptionalPropertyTypes`, and it never checked `groundY` at all. The
condition is written out in full, as `GameStage.addScatter` already does.

Verified at runtime: `DefaultLoadingScreen` while the assets load, then
`GroundShadowsStage` with `isLoading` false, and the sun still turning.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NGvtaUNATVCVxD2qcbiY4t
Copilot AI balanced review requested due to automatic review settings October 6, 2026 01:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@obiot
obiot merged commit 32aa9d2 into master Oct 6, 2026
6 checks passed
@obiot
obiot deleted the fix/ground-shadows-stage branch October 6, 2026 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants