My torch is correctly appearing on the editor but not in game. I’ve tried a lot of things such as trying to put my torch lower so that the Y sort works better but nothing… I saw somewhere that the TileMapLayer may be guilty. But I don’t know how to deal with it.
First I’ve just opened the editor and I do not have the inconsistency between the editor and the game anymore. (I’ve done nothing but ok… why not…).
On the other hand, I still have the issue where my torch don’t want to be above my wall while it should be. Here is the details I could find :
torch : is a animatedSprite2D with all parameters of visibility and ordering set to default, except the Y sort that is enabled. (so z index set to 0)
wall : is a TileMapLayer with all parameters of visibility and oredering set to default, except the Y sort that is also enabled and the light mask that is set only on 2. (so z index set to 0)
As you can see on the picture above, the sorting in my files should be lead to my torch above my wall but it isn’t.
In my opinion here is all the details. If you want more ask me more precisely.
if event is InputEventMouseButton and event.pressed:
PlayerState.nbr_torch += 1
update_vision_radius()
queue_free() # si tu veux la supprimer après récupération
func update_vision_radius() → void:
var walls_light := PlayerState.player.get_node("walls_light")
var ground_light := PlayerState.player.get_node("ground_light")
walls_light.texture_scale = 1.0
ground_light.texture_scale = 1.0
Here it is. So I don’t think so… (walls do not have script)
I’ve just done it. The torch is above when all Y sort enabled. It suffices to disabled the Y sorting for Room_11 and I can see it (but then the player can go behind the walls).
For the canevasModulate’s issue, this should not be a problem since my torch as light in its scene. And you can see that it actually works since the walls has lightning.
May be it is interesting to say that Room_11 is a deep leaf. I have :
world (node2D) :
player
dungeon (node2D) :
- current_room (node2D) (it is set to Room_11 I don’t have any other yet)
Since there is layers and layers of Y sorting may be there is issue that comes from there ?
If the parent Room11 Node2D doesn’t have Y-sorted enabled, then the torches and walls aren’t Y-sorted relative to each other. And the player will only be Y-sorted compared to the whole Room11 scene, but not inidividual tiles and torches.
What are the wall tiles’ y_sort_origin set to? The bottom of the tile?
the y_sort_origin was in the middle of the tile. I supposed that the origin is always set to the upper edge by default. I had no clue that we can change that. Thanks a lot !!