Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Antilo |
Hello!
i have the following structure of nodes
- navigation2d
->TileMap (floor)
->TileMap (walls) (y-sort property on)
→ ->Animation Character Scene1 (Player)
→ ->Animation Character Scene2 (Enemy)
when i do it this way it works at it should… and the ysort property hierarchy works
but i need to create instances of enemy for it respawn so in the navigation2D node i have the following script:
var Enemy = preload("res://Enemy.tscn")
func _ready():
var new_enemy = Enemy.instance()
get_node("wall").add_child(new_enemy)
if i create the enemy this way… the y sort is not respected, and the enemy is draw over everything, including walls…
Any ideas how to go on?