Repository navigation
Examples: give the Ground Shadows scene a stage of its own - #1716
Merged
Merged
Conversation
`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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
loader.preload()switches tostate.LOADING, and that stage istransitional. The example built its scene in the preload callback and then
called
state.change(state.DEFAULT)to get out of it, which the scenes skilldescribes as the fallback you take when you will not write a stage:
Taking the documented second-best in a reference example teaches it. 34 of
this repo's examples register a
PLAYstage; this is now one of them.The scene is built in
onResetEvent, the per-frame work moved from aRenderablethat drew nothing into the stage's ownupdate, and the pointerhandlers and the DOM panel are released in
onDestroyEventrather than from ateardown closure the engine knows nothing about. The asset list is lifted into
a
resourcesconst so the tail reads as "load, then switch".Also fixes a type error in
jungleRabbit/scenery.ts: a boolean does notnarrow
normal/groundYat the spread site underexactOptionalPropertyTypes, and it never checkedgroundYat all. Thecondition is written out in full, as
GameStage.addScatteralready does.Verified at runtime:
DefaultLoadingScreenwhile the assets load, thenGroundShadowsStagewithisLoadingfalse, and the sun still turning.🤖 Generated with Claude Code
https://claude.ai/code/session_01NGvtaUNATVCVxD2qcbiY4t