Skip to content

Examples: a Sprite showcase, in space - #1790

Merged
obiot merged 1 commit into
masterfrom
feat/sprite-showcase
Oct 29, 2026
Merged

obiot merged 1 commit into
masterfrom
feat/sprite-showcase

Conversation

@obiot

@obiot obiot commented Oct 29, 2026

Copy link
Copy Markdown
Member

Description

Replaces the sprite example (two monsters turning over a galaxy, built in the preload callback through the global game) with a small scene in space showing what a Sprite can do. It is built in its own Stage, from the app instance.

  • The monster in the middle breathes and leans (scale, rotate). It wears a different shader effect every 3.5 s, or on a click (isKinematic = false, registerPointerEvent): Glow, Shine, Sway, Hologram, Dissolve, then Outline + Glow chained. The effects are added once and switched with enabled, since removePostEffect destroys them.
  • Eight coins cut from the platformer's TexturePacker atlas orbit it. They spin (scale, flipX) under one shared ShineEffect (shared = true), and pass in front of the monster and behind it by changing depth. A world sorted on "z" does not re-sort on a depth change, so the example calls world.sortNow() when a coin changes side.
  • The astronaut drifts across, walking in mid-air (addAnimation, play), facing the way it goes and turning. Two flies buzz in figures of eight.
  • Small monsters float about, tinted, fading (setOpacity), two of them additive (blendMode = "lighter").
  • The backdrop is Earth Defender's nebula, drawn once at the size of the screen with the same noise, larger and dimmer so the sprites read: sprite/assets/nebula.webp, 32 KB. galaxy.png stays, as the mesh3d and blend-mode examples load it from this folder.
  • On Canvas, everything but the effects runs, and the caption says shader effects need WebGL or WebGPU.

Also, docs only: TextureAtlas#createAnimationFromName had no documentation. Since #1008 put getAnimationSettings between the method and its doc comment, its docs sat on the wrong method, and TypeScript required both of its arguments. The comment is back on its method, with a typo fixed. Both arguments are now optional in the declarations, as they always were at runtime.

Type of change

  • Bug fix
  • New feature
  • Documentation update
  • Performance improvement
  • Refactoring (no functional changes)

Checklist

  • I have read the Contributing Guide
  • My code follows the existing code style (pnpm lint passes): biome on the changed files, eslint on atlas.js
  • I have tested my changes locally (pnpm test passes): example only; the engine change is a doc comment
  • I have added tests that cover my changes (if applicable)
  • The build succeeds (pnpm build): pnpm types regenerated the declarations (createAnimationFromName(names?, settings?))

Checked in a browser: the example runs on WebGL, WebGPU and Canvas with no console errors. Clicking the monster steps through all six looks. The near coins draw over the monster and the far ones behind it.

Related issues

None.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SeWCkETjW35ZbXDRswV1hx

The sprite example was two monsters turning over a galaxy, built in the
preload callback through the global `game`. It is now a small scene
showing what a Sprite can do, built in its own Stage from the app
instance:

- the monster in the middle breathes and leans (scale, rotate) and
  wears a different shader effect every few seconds, or on a click:
  Glow, Shine, Sway, Hologram, Dissolve, then Outline and Glow chained;
- eight coins cut from the platformer's TexturePacker atlas orbit it,
  spinning (scale, flipX) under one shared Shine, and pass in front of
  it and behind it (depth, with world.sortNow());
- the astronaut drifts across, walking in mid-air (addAnimation, play),
  facing the way it goes and turning; flies buzz in figures of eight;
- small monsters float about, tinted, fading, two of them additive.

The backdrop is Earth Defender's nebula drawn once at the size of the
screen with the same noise, larger and dimmer so the sprites read:
a 32 KB WebP. On Canvas everything but the effects runs, and the caption
says so.

Also: TextureAtlas#createAnimationFromName had no documentation since
#1008 put getAnimationSettings between it and its doc comment, so its
docs sat on the wrong method and TypeScript required both its
arguments. The comment is back on its method (with a typo fixed).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SeWCkETjW35ZbXDRswV1hx
Copilot AI balanced review requested due to automatic review settings October 29, 2026 04:45

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 insufficient remaining quota.

@obiot
obiot merged commit 7040cc7 into master Oct 29, 2026
6 checks passed
@obiot
obiot deleted the feat/sprite-showcase branch October 29, 2026 07:53
@obiot obiot mentioned this pull request Oct 30, 2026
1 of 10 tasks
obiot added a commit that referenced this pull request Oct 30, 2026
Dates the 20.12.0 changelog section (2026-10-30) and adds the one
shipped change it was missing: TextureAtlas#createAnimationFromName's
arguments are optional in the declarations again (#1790).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SeWCkETjW35ZbXDRswV1hx
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