I’m currently working on a game similar to Terraria and I’m trying to implement a block-based lighting system
How my lighting idea works:
Each block has a variable called light that ranges from 1-15, where15 is the brightest
To simulate sunlight I spawn a row of blocks high above the world and cast*raycasts downwards.
When a ray hits the first block, I set its light = 15 (this is the topmost block that receives sunlight).
Then I want to propagate the light to adjacent blocks like this:
- If a block has light > 1 it should check its4 direct neighbors(left, right, up, down).
- For each neighbor:
Ifneighbor.light < current.light - 1, setneighbor.light = current.light - 1 - This way the light will “spread” outward and gradually decay.
But my proplem ;All blocks are instances of one single object (only one object type in the object list).
So I can’t directly reference BlockA or BlockB in GDevelop events.
I tried using Point is inside object to detect neighbors ,placing 4 points around the block but this didn’t work.
There’s no visual result or effect — it seems like the event doesn’t pick the correct neighbor block.
question:Is there any way to pass values like light from one block to a specific neighbor block (within a single object group)?
I’m trying to avoid creating multiple separate block objects just to reference neighbors.