Closed Dead-TR closed 9 months ago
If I remove "ge_heightShift" then the light works. But, obviously, this is not a solution to the problem.
I am not entirely sure how Light2D works. ge_heightShift will create one layer for each tile row under the hood. The only way to disable ge_heightShift is to remove it from the tile map.
I assume you want to keep it but fix the lighting? Can Light2D be applied to several layers at once? That would solve the problem but I am not sure about the performance.
The grid engine overlay operates using a pipeline, the same as Light2D. Because of this, I cannot simultaneously use both systems. However, since I don't want to abandon the grid engine, I will build a custom solution for the overlay. But, I think it should be mentioned.
Grid Engine does not explicitly set a pipeline. It is simply calling Tilemap.createBlankLayer to create the extra layers. If you check out the MultiPipeline in the phaser docs it says:
Virtually all Game Objects use this pipeline by default, including Sprites, Graphics and Tilemaps.
I see this as a pure Phaser thing which does not need to be mentioned again in Grid Engine. Or did you want to say that you think in the docs we should be mentioning the fact that multiple tile layers are created for the height shift?
Indeed, you are right. It seems to be something that works inside the Phaser. I don't understand why, but if I additionally specify "setPipeline" at the end of "create", then everything works as it should. Thank you
this.tilemap?.layers.forEach((layer) => layer.tilemapLayer.setPipeline("Light2D"), );
Previously, I called "setPipeline" immediately after "createLayer". Looks like that was the problem. Thanks for the help!
You're welcome.
Probably you called it before GridEngine.create? Because that will create the additional tile layers.
If I assign the 'ge_heightShift' parameter to a layer in Tiled, lighting will not work on that layer. I understand that this is intended for overlapping objects, but is there a way to disable this? Or is it detailed somewhere in the documentation?