A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
examples(lighting-2d): interactive 2D lighting + soft-shadow showcase
yhh46e538e8015f
diff --git a/examples/lighting-2d/.gitignore b/examples/lighting-2d/.gitignorenew file mode 100644index 000000000..359472ac2--- /dev/null+++ b/examples/lighting-2d/.gitignore@@ -0,0 +1,7 @@+node_modules/+dist/+.vscode/+.idea/+.DS_Store+Thumbs.db+.esengine/cache/diff --git a/examples/lighting-2d/README.md b/examples/lighting-2d/README.mdnew file mode 100644index 000000000..7b7081b10--- /dev/null+++ b/examples/lighting-2d/README.md@@ -0,0 +1,63 @@+# 2D Lighting++A hands-on tour of the engine's dynamic 2D lighting: a `Light2D` **torch** that+follows your mouse through a near-dark room, `Light2D` lamps you drop with a+click, and `ShadowCaster2D` boxes that block light and cast **real-time soft+shadows**.++## Controls++| Input | Action |+| -------------- | -------------------------------------------------------------- |+| Move mouse | The torch follows the cursor, revealing walls and casting shadows |+| Left-click | Drop a fixed colored light (cycles red → green → blue → warm white) |+| Right-click | Drop a box obstacle that blocks light and casts a shadow |+| `C` | Clear everything you placed |++Placed lights are capped at 10 and obstacles at 6; when you exceed a cap the+oldest one fades out and is removed, keeping the scene inside the GPU's 16-light+/ 8-occluder budget.++## How it works++Lighting is **multiplicative**: a lit surface renders as+`albedo × (ambient + Σ lights)`. With the ambient term set very low (~0.06), an+unlit wall is nearly black — so a light does not just brighten the room, it+*reveals* it.++- **The room** is a grid of tiles plus a few prop sprites, all using the+ `assets/materials/lit.esmaterial` material. Its shader declares+ `#pragma domain Lit2D`, which makes the engine inject the per-frame light+ uniforms and the `es_applyLighting2D()` helper the fragment shader calls. A+ sprite with no material stays unlit (full-bright) — that is why the light+ markers and obstacle boxes are always visible.+- **The torch** (`src/systems/torch.ts`) is a `Light2D` of type `Point`. Each+ frame it is moved to `UICameraInfo.worldMouseX/Y`, the cursor already+ projected into world space by the active camera.+- **Placing & clearing** (`src/systems/place.ts`) reads mouse buttons and the+ `C` key from the `Input` resource and uses `Commands` to spawn/despawn+ entities. Left-click spawns a `Light2D`, right-click spawns a `ShadowCaster2D`.+- **Fading** (`src/systems/fade.ts`) dims an evicted or cleared entity's light+ and sprite to zero over a short window, then despawns it.++Shadow softness comes from the light's `shadowSoftness` field: the torch uses a+larger value for a wide penumbra, placed lights a smaller one for crisper edges.++## Files++```+assets/+ materials/+ lit.esshader # #pragma domain Lit2D — flat-normal lit surface+ lit.esmaterial # material that binds the shader (no texture → color = albedo)+ scenes/+ main.esscene # camera, ambient, torch, the tile/prop room, two pillars+src/+ main.ts # registers the three systems+ config.ts # shared tuning (colors, radii, caps, fade)+ components.ts # Torch tag, Fading component+ systems/+ torch.ts # torch follows the mouse+ place.ts # click to place lights/obstacles, C to clear+ fade.ts # fade-out + despawn of removed entities+```diff --git a/examples/lighting-2d/assets/materials/lit.esmaterial b/examples/lighting-2d/assets/materials/lit.esmaterialnew file mode 100644index 000000000..ac92f1385--- /dev/null+++ b/examples/lighting-2d/assets/materials/lit.esmaterial@@ -0,0 +1,8 @@+{+ "version": "1.0",+ "type": "material",+ "shader": "lit.esshader",+ "blendMode": 0,+ "depthTest": false,+ "properties": {}+}diff --git a/examples/lighting-2d/assets/materials/lit.esmaterial.meta b/examples/lighting-2d/assets/materials/lit.esmaterial.metanew file mode 100644index 000000000..12e848ba6--- /dev/null+++ b/examples/lighting-2d/assets/materials/lit.esmaterial.meta@@ -0,0 +1,6 @@+{+ "uuid": "7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d",+ "version": "2.0",+ "type": "material",+ "importer": {}+}diff --git a/examples/lighting-2d/assets/materials/lit.esshader b/examples/lighting-2d/assets/materials/lit.esshadernew file mode 100644index 000000000..4683b853b--- /dev/null+++ b/examples/lighting-2d/assets/materials/lit.esshader@@ -0,0 +1,49 @@+#pragma shader "Lighting2D"+#pragma version 300 es+#pragma domain Lit2D++#pragma vertex+layout(location = 0) in vec2 a_position;+layout(location = 1) in vec4 a_color;+layout(location = 2) in vec2 a_texCoord;+layout(location = 3) in float a_texIndex;++layout(std140) uniform FrameConstants {+ mat4 u_projection;+};++out vec4 v_color;+out vec2 v_texCoord;+out highp vec2 v_worldPos;++void main() {+ gl_Position = u_projection * vec4(a_position, 0.0, 1.0);+ v_color = a_color;+ v_texCoord = a_texCoord;+ // The batch path bakes the transform into the vertices, so a_position is already world-space.+ v_worldPos = a_position;+}+#pragma end++#pragma fragment+precision mediump float;++in vec4 v_color;+in vec2 v_texCoord;+in highp vec2 v_worldPos;++uniform sampler2D u_textures[8];++out vec4 fragColor;++// The LightConstants block + es_applyLighting2D() are injected by the engine for+// `#pragma domain Lit2D`. These surfaces carry no texture, so u_textures[0] is the+// default 1×1 white — the sprite's `color` becomes the albedo the lights multiply.+// A flat normal faces the camera (2D has no per-sprite tangent frame).+void main() {+ vec4 base = texture(u_textures[0], v_texCoord) * v_color;+ vec3 N = vec3(0.0, 0.0, 1.0);+ vec3 lit = es_applyLighting2D(base.rgb, N, v_worldPos);+ fragColor = vec4(lit, base.a);+}+#pragma enddiff --git a/examples/lighting-2d/assets/materials/lit.esshader.meta b/examples/lighting-2d/assets/materials/lit.esshader.metanew file mode 100644index 000000000..009a98ddf--- /dev/null+++ b/examples/lighting-2d/assets/materials/lit.esshader.meta@@ -0,0 +1,6 @@+{+ "uuid": "2b8e6d40-1a3c-4f9b-8e7d-5c4b3a2f1e0d",+ "version": "2.0",+ "type": "shader",+ "importer": {}+}diff --git a/examples/lighting-2d/assets/scenes/main.esscene b/examples/lighting-2d/assets/scenes/main.esscenenew file mode 100644index 000000000..8e84fe000--- /dev/null+++ b/examples/lighting-2d/assets/scenes/main.esscene@@ -0,0 +1,2506 @@+{+ "version": "1.0",+ "name": "Main",+ "entities": [+ {+ "id": 0,+ "name": "Camera",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": 0,+ "z": 10+ }+ }+ },+ {+ "type": "Camera",+ "data": {+ "projectionType": 1,+ "orthoSize": 360,+ "isActive": true,+ "priority": 0+ }+ }+ ],+ "visible": true+ },+ {+ "id": 1,+ "name": "Ambient",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Light2D",+ "data": {+ "type": 2,+ "color": {+ "r": 1,+ "g": 1,+ "b": 1,+ "a": 1+ },+ "intensity": 0.06,+ "enabled": true+ }+ }+ ],+ "visible": true+ },+ {+ "id": 2,+ "name": "Torch",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 0,+ "y": 0,+ "z": 0+ }+ }+ },+ {+ "type": "Light2D",+ "data": {+ "type": 0,+ "color": {+ "r": 1,+ "g": 0.92,+ "b": 0.78,+ "a": 1+ },+ "intensity": 1.4,+ "radius": 320,+ "shadowSoftness": 18,+ "enabled": true+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 22,+ "y": 22+ },+ "color": {+ "r": 1,+ "g": 0.95,+ "b": 0.82,+ "a": 1+ },+ "layer": 6+ }+ },+ {+ "type": "Torch",+ "data": {}+ }+ ],+ "visible": true+ },+ {+ "id": 100,+ "name": "Tile_0_0",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -576,+ "y": -310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 101,+ "name": "Tile_1_0",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -448,+ "y": -310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 102,+ "name": "Tile_2_0",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -320,+ "y": -310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 103,+ "name": "Tile_3_0",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -192,+ "y": -310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 104,+ "name": "Tile_4_0",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -64,+ "y": -310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 105,+ "name": "Tile_5_0",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 64,+ "y": -310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 106,+ "name": "Tile_6_0",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 192,+ "y": -310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 107,+ "name": "Tile_7_0",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 320,+ "y": -310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 108,+ "name": "Tile_8_0",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 448,+ "y": -310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 109,+ "name": "Tile_9_0",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 576,+ "y": -310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 110,+ "name": "Tile_0_1",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -576,+ "y": -186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 111,+ "name": "Tile_1_1",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -448,+ "y": -186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 112,+ "name": "Tile_2_1",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -320,+ "y": -186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 113,+ "name": "Tile_3_1",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -192,+ "y": -186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 114,+ "name": "Tile_4_1",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -64,+ "y": -186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 115,+ "name": "Tile_5_1",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 64,+ "y": -186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 116,+ "name": "Tile_6_1",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 192,+ "y": -186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 117,+ "name": "Tile_7_1",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 320,+ "y": -186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 118,+ "name": "Tile_8_1",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 448,+ "y": -186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 119,+ "name": "Tile_9_1",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 576,+ "y": -186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 120,+ "name": "Tile_0_2",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -576,+ "y": -62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 121,+ "name": "Tile_1_2",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -448,+ "y": -62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 122,+ "name": "Tile_2_2",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -320,+ "y": -62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 123,+ "name": "Tile_3_2",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -192,+ "y": -62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 124,+ "name": "Tile_4_2",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -64,+ "y": -62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 125,+ "name": "Tile_5_2",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 64,+ "y": -62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 126,+ "name": "Tile_6_2",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 192,+ "y": -62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 127,+ "name": "Tile_7_2",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 320,+ "y": -62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 128,+ "name": "Tile_8_2",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 448,+ "y": -62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 129,+ "name": "Tile_9_2",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 576,+ "y": -62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 130,+ "name": "Tile_0_3",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -576,+ "y": 62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 131,+ "name": "Tile_1_3",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -448,+ "y": 62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 132,+ "name": "Tile_2_3",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -320,+ "y": 62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 133,+ "name": "Tile_3_3",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -192,+ "y": 62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 134,+ "name": "Tile_4_3",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -64,+ "y": 62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 135,+ "name": "Tile_5_3",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 64,+ "y": 62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 136,+ "name": "Tile_6_3",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 192,+ "y": 62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 137,+ "name": "Tile_7_3",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 320,+ "y": 62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 138,+ "name": "Tile_8_3",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 448,+ "y": 62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 139,+ "name": "Tile_9_3",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 576,+ "y": 62,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 140,+ "name": "Tile_0_4",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -576,+ "y": 186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 141,+ "name": "Tile_1_4",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -448,+ "y": 186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 142,+ "name": "Tile_2_4",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -320,+ "y": 186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 143,+ "name": "Tile_3_4",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -192,+ "y": 186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 144,+ "name": "Tile_4_4",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -64,+ "y": 186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 145,+ "name": "Tile_5_4",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 64,+ "y": 186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 146,+ "name": "Tile_6_4",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 192,+ "y": 186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 147,+ "name": "Tile_7_4",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 320,+ "y": 186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 148,+ "name": "Tile_8_4",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 448,+ "y": 186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 149,+ "name": "Tile_9_4",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 576,+ "y": 186,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 150,+ "name": "Tile_0_5",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -576,+ "y": 310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 151,+ "name": "Tile_1_5",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -448,+ "y": 310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 152,+ "name": "Tile_2_5",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -320,+ "y": 310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 153,+ "name": "Tile_3_5",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -192,+ "y": 310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 154,+ "name": "Tile_4_5",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -64,+ "y": 310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 155,+ "name": "Tile_5_5",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 64,+ "y": 310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 156,+ "name": "Tile_6_5",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 192,+ "y": 310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 157,+ "name": "Tile_7_5",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 320,+ "y": 310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 158,+ "name": "Tile_8_5",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 448,+ "y": 310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.56,+ "g": 0.58,+ "b": 0.62,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 159,+ "name": "Tile_9_5",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 576,+ "y": 310,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 116,+ "y": 116+ },+ "color": {+ "r": 0.68,+ "g": 0.7,+ "b": 0.74,+ "a": 1+ },+ "layer": 0,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 200,+ "name": "Crate",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -330,+ "y": -150,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 120,+ "y": 120+ },+ "color": {+ "r": 0.8,+ "g": 0.55,+ "b": 0.32,+ "a": 1+ },+ "layer": 1,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 201,+ "name": "Crystal",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 300,+ "y": 170,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 96,+ "y": 96+ },+ "color": {+ "r": 0.45,+ "g": 0.85,+ "b": 0.95,+ "a": 1+ },+ "layer": 1,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 202,+ "name": "Ruby",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 170,+ "y": -195,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 104,+ "y": 104+ },+ "color": {+ "r": 0.85,+ "g": 0.3,+ "b": 0.42,+ "a": 1+ },+ "layer": 1,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 203,+ "name": "Emerald",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -270,+ "y": 185,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 92,+ "y": 92+ },+ "color": {+ "r": 0.4,+ "g": 0.8,+ "b": 0.45,+ "a": 1+ },+ "layer": 1,+ "material": "@uuid:7f3a9c12-4d5e-4b6a-9c8d-1e2f3a4b5c6d"+ }+ }+ ],+ "visible": true+ },+ {+ "id": 300,+ "name": "PillarA",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": -90,+ "y": 20,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 64,+ "y": 180+ },+ "color": {+ "r": 0.22,+ "g": 0.24,+ "b": 0.3,+ "a": 1+ },+ "layer": 2+ }+ },+ {+ "type": "ShadowCaster2D",+ "data": {+ "size": {+ "x": 64,+ "y": 180+ },+ "enabled": true+ }+ }+ ],+ "visible": true+ },+ {+ "id": 301,+ "name": "PillarB",+ "parent": null,+ "children": [],+ "components": [+ {+ "type": "Transform",+ "data": {+ "position": {+ "x": 260,+ "y": -40,+ "z": 0+ }+ }+ },+ {+ "type": "Sprite",+ "data": {+ "size": {+ "x": 90,+ "y": 90+ },+ "color": {+ "r": 0.22,+ "g": 0.24,+ "b": 0.3,+ "a": 1+ },+ "layer": 2+ }+ },+ {+ "type": "ShadowCaster2D",+ "data": {+ "size": {+ "x": 90,+ "y": 90+ },+ "enabled": true+ }+ }+ ],+ "visible": true+ }+ ]+}diff --git a/examples/lighting-2d/project.esproject b/examples/lighting-2d/project.esprojectnew file mode 100644index 000000000..4c8bc18e0--- /dev/null+++ b/examples/lighting-2d/project.esproject@@ -0,0 +1,13 @@+{+ "formatVersion": "1",+ "name": "2D Lighting",+ "description": "A near-dark room lit by a mouse torch — left-click drops colored lights, right-click drops obstacles that cast real-time soft shadows.",+ "tag": "Rendering",+ "version": "0.1.0",+ "defaultScene": "assets/scenes/main.esscene",+ "designResolution": {+ "width": 1280,+ "height": 720+ },+ "spineVersion": "none"+}diff --git a/examples/lighting-2d/src/components.ts b/examples/lighting-2d/src/components.tsnew file mode 100644index 000000000..681b3e7d8--- /dev/null+++ b/examples/lighting-2d/src/components.ts@@ -0,0 +1,11 @@+import { defineComponent, defineTag } from 'esengine';++// Marks the single light that tracks the mouse cursor every frame.+export const Torch = defineTag('Torch');++// Attached when a placed light or obstacle is evicted (the FIFO cap is hit) or+// cleared with C. The fade system counts `remaining` down, dims the entity, then+// despawns it.+export const Fading = defineComponent('Fading', {+ remaining: 0.35,+});diff --git a/examples/lighting-2d/src/config.ts b/examples/lighting-2d/src/config.tsnew file mode 100644index 000000000..3d5f94a04--- /dev/null+++ b/examples/lighting-2d/src/config.ts@@ -0,0 +1,28 @@+// Shared tuning for the lighting demo. Kept in one place so the placing system+// and the fade-out system agree on the numbers (a placed light's intensity is+// faded back down from exactly the value it was spawned with).++// Colors a left-click cycles through, one per placed light.+export const LIGHT_COLORS = [+ { r: 1.0, g: 0.35, b: 0.30, a: 1 }, // red+ { r: 0.35, g: 1.0, b: 0.45, a: 1 }, // green+ { r: 0.40, g: 0.55, b: 1.0, a: 1 }, // blue+ { r: 1.0, g: 0.90, b: 0.70, a: 1 }, // warm white+];++export const PLACED_LIGHT_INTENSITY = 1.15;+export const PLACED_LIGHT_RADIUS = 260;+export const PLACED_LIGHT_SOFTNESS = 10;++// Box occluder placed by a right-click (world units, centered on the cursor).+export const OBSTACLE_SIZE = { x: 84, y: 84 };++// The GPU packs at most 16 lights and 8 occluders per frame; the scene already+// spends a torch + ambient + two pillars, so we cap the interactive placements+// well under those limits and fade the oldest out when the cap is reached.+export const MAX_LIGHTS = 10;+export const MAX_OBSTACLES = 6;++// Seconds an evicted / cleared entity takes to fade its light and sprite to zero+// before it despawns.+export const FADE_DURATION = 0.35;diff --git a/examples/lighting-2d/src/main.ts b/examples/lighting-2d/src/main.tsnew file mode 100644index 000000000..c457cbce9--- /dev/null+++ b/examples/lighting-2d/src/main.ts@@ -0,0 +1,23 @@+// 2D Lighting — the engine's dynamic Light2D + ShadowCaster2D system shown+// interactively. The scene is a near-black room whose walls and props use a+// `Lit2D` material, so they are only visible where light reaches them.+//+// • Move the mouse — a torch (Point light) follows the cursor, revealing the+// room and casting soft shadows off the pillars.+// • Left-click — drop a fixed colored light (cycles red/green/blue/warm).+// • Right-click — drop a box obstacle that blocks light and casts shadow.+// • C — clear everything you placed.+//+// Lighting is multiplicative (surface = albedo × (ambient + Σ lights)), so an+// unlit surface is nearly black and each light adds to it — the reason a torch+// "reveals" the room rather than merely brightening it.+import { addSystemToSchedule, Schedule } from 'esengine';++import './components';+import { torchSystem } from './systems/torch';+import { placeSystem } from './systems/place';+import { fadeSystem } from './systems/fade';++addSystemToSchedule(Schedule.Update, torchSystem);+addSystemToSchedule(Schedule.Update, placeSystem);+addSystemToSchedule(Schedule.Update, fadeSystem);diff --git a/examples/lighting-2d/src/systems/fade.ts b/examples/lighting-2d/src/systems/fade.tsnew file mode 100644index 000000000..8b49457d1--- /dev/null+++ b/examples/lighting-2d/src/systems/fade.ts@@ -0,0 +1,35 @@+import {+ defineSystem, Query, Mut, Res, Time, Commands,+ Sprite, Light2D, ShadowCaster2D,+} from 'esengine';+import { Fading } from '../components';+import { PLACED_LIGHT_INTENSITY, FADE_DURATION } from '../config';++// Dims placed entities to nothing over FADE_DURATION, then despawns them. The+// two queries are disjoint: a placed light has Light2D (no ShadowCaster2D), an+// obstacle has ShadowCaster2D (no Light2D), so each entity is ticked exactly+// once. The torch never gets a Fading component, so it is never matched here.+export const fadeSystem = defineSystem(+ [+ Query(Mut(Fading), Mut(Sprite), Mut(Light2D)),+ Query(Mut(Fading), Mut(Sprite), ShadowCaster2D),+ Res(Time),+ Commands(),+ ],+ (fadingLights, fadingObstacles, time, cmds) => {+ for (const [entity, fading, sprite, light] of fadingLights) {+ fading.remaining -= time.delta;+ const t = Math.max(0, fading.remaining / FADE_DURATION);+ light.intensity = PLACED_LIGHT_INTENSITY * t;+ sprite.color.a = t;+ if (fading.remaining <= 0) cmds.despawn(entity);+ }+ for (const [entity, fading, sprite] of fadingObstacles) {+ fading.remaining -= time.delta;+ const t = Math.max(0, fading.remaining / FADE_DURATION);+ sprite.color.a = t;+ if (fading.remaining <= 0) cmds.despawn(entity);+ }+ },+ { name: 'FadeSystem' },+);diff --git a/examples/lighting-2d/src/systems/place.ts b/examples/lighting-2d/src/systems/place.tsnew file mode 100644index 000000000..32356fd36--- /dev/null+++ b/examples/lighting-2d/src/systems/place.ts@@ -0,0 +1,75 @@+import {+ defineSystem, Res, Input, Commands, UICameraInfo,+ Transform, Sprite, Light2D, Light2DType, ShadowCaster2D,+} from 'esengine';+import type { UICameraData } from 'esengine';+import { Fading } from '../components';+import {+ LIGHT_COLORS, PLACED_LIGHT_INTENSITY, PLACED_LIGHT_RADIUS, PLACED_LIGHT_SOFTNESS,+ OBSTACLE_SIZE, MAX_LIGHTS, MAX_OBSTACLES, FADE_DURATION,+} from '../config';++// FIFO records of what the player has placed. When a list exceeds its cap the+// oldest entity is tagged Fading (the fade system dims and despawns it), so the+// scene stays within the GPU's light/occluder budget.+const lights: number[] = [];+const obstacles: number[] = [];+let nextColor = 0;++// Left-click → colored Point light, right-click → box obstacle, C → clear.+// Placed markers use the default (unlit) material so a light always reads as a+// bright dot and an obstacle as a solid block, regardless of the lighting.+export const placeSystem = defineSystem(+ [Res(Input), Res(UICameraInfo), Commands()],+ (input, camera: UICameraData, cmds) => {+ if (camera.valid) {+ const x = camera.worldMouseX;+ const y = camera.worldMouseY;++ if (input.isMouseButtonPressed(0)) {+ const color = LIGHT_COLORS[nextColor % LIGHT_COLORS.length];+ nextColor++;+ const entity = cmds.spawn()+ .insert(Transform, { position: { x, y, z: 0 } })+ .insert(Light2D, {+ type: Light2DType.Point,+ color,+ intensity: PLACED_LIGHT_INTENSITY,+ radius: PLACED_LIGHT_RADIUS,+ shadowSoftness: PLACED_LIGHT_SOFTNESS,+ enabled: true,+ })+ .insert(Sprite, { size: { x: 18, y: 18 }, color, layer: 5 })+ .id();+ lights.push(entity);+ if (lights.length > MAX_LIGHTS) {+ cmds.entity(lights.shift()!).insert(Fading, { remaining: FADE_DURATION });+ }+ }++ if (input.isMouseButtonPressed(2)) {+ const entity = cmds.spawn()+ .insert(Transform, { position: { x, y, z: 0 } })+ .insert(Sprite, {+ size: OBSTACLE_SIZE,+ color: { r: 0.22, g: 0.24, b: 0.30, a: 1 },+ layer: 4,+ })+ .insert(ShadowCaster2D, { size: OBSTACLE_SIZE, enabled: true })+ .id();+ obstacles.push(entity);+ if (obstacles.length > MAX_OBSTACLES) {+ cmds.entity(obstacles.shift()!).insert(Fading, { remaining: FADE_DURATION });+ }+ }+ }++ if (input.isKeyPressed('KeyC')) {+ for (const entity of lights) cmds.entity(entity).insert(Fading, { remaining: FADE_DURATION });+ for (const entity of obstacles) cmds.entity(entity).insert(Fading, { remaining: FADE_DURATION });+ lights.length = 0;+ obstacles.length = 0;+ }+ },+ { name: 'PlaceSystem' },+);diff --git a/examples/lighting-2d/src/systems/torch.ts b/examples/lighting-2d/src/systems/torch.tsnew file mode 100644index 000000000..10b224721--- /dev/null+++ b/examples/lighting-2d/src/systems/torch.ts@@ -0,0 +1,20 @@+import {+ defineSystem, Query, Mut, Res, Transform, UICameraInfo,+} from 'esengine';+import type { UICameraData } from 'esengine';+import { Torch } from '../components';++// Pin the torch entity (a Point light + a small bright marker sprite) to the+// world-space mouse position. UICameraInfo already projects the cursor through+// the active camera, so no manual screen→world math is needed.+export const torchSystem = defineSystem(+ [Query(Mut(Transform), Torch), Res(UICameraInfo)],+ (torches, camera: UICameraData) => {+ if (!camera.valid) return;+ for (const [, transform] of torches) {+ transform.position.x = camera.worldMouseX;+ transform.position.y = camera.worldMouseY;+ }+ },+ { name: 'TorchSystem' },+);diff --git a/examples/lighting-2d/thumbnail.png b/examples/lighting-2d/thumbnail.pngnew file mode 100644index 000000000..c5fe4b93cBinary files /dev/null and b/examples/lighting-2d/thumbnail.png differdiff --git a/examples/lighting-2d/tsconfig.json b/examples/lighting-2d/tsconfig.jsonnew file mode 100644index 000000000..0a8528b29--- /dev/null+++ b/examples/lighting-2d/tsconfig.json@@ -0,0 +1,22 @@+{+ "compilerOptions": {+ "target": "ES2020",+ "module": "ESNext",+ "moduleResolution": "bundler",+ "strict": true,+ "esModuleInterop": true,+ "skipLibCheck": true,+ "forceConsistentCasingInFileNames": true,+ "declaration": false,+ "outDir": "./dist",+ "rootDir": ".",+ "baseUrl": ".",+ "paths": {+ "esengine": ["./.esengine/sdk/index.d.ts"],+ "esengine/wasm": ["./.esengine/sdk/wasm.d.ts"],+ "@esengine/editor": ["./.esengine/editor/index.d.ts"]+ }+ },+ "include": ["src/**/*"],+ "exclude": ["node_modules"]+}