🌑 2D Darkness and Light System

GameCrom includes a complete 2D lighting system based on masking layers, fully compatible with the Canvas engine and without relying on WebGL. This system allows you to create dynamic darkness effects such as caves, flashlights, torches, or realistic night scenes, all with perfect performance even on mobile browsers.

🧱 General Concept

The system works with two types of objects:

🔹 Lights and darkness are regular objects in the editor (not components).
🔹 They are automatically drawn in the correct render order.
🔹 No scripts or physics required — everything is handled visually.

💡 Light Object

Lights are used to illuminate specific areas of the scene.

Available Properties:

// Example: warm torch light
{
  type: "light",
  x: 320,
  y: 240,
  radius: 250,
  intensity: 0.8,
  color: "#ffb84d",
  layer: 20,
  active: true,
  visible: true
}

🌑 Darkness Object

This object creates the global darkness layer. Only one can exist per scene, and it covers the entire camera view during gameplay. Lighted areas are cut out dynamically.

Properties:

⚠️ In the editor, the darkness is not drawn visually to avoid blocking your view,
but it always appears in the hierarchy and renders automatically in the game.

📌 Recommendations

✅ This system delivers realistic lighting effects without shaders, is lightweight, scalable, and works on any modern device.