Access node from scrip that is a child of instanced scene

Godot Version



I am making a movement component so I can just attach it to anything I want to be able to move. The code all works fine when it is part of the main script on the root node for the character (in this case the player) but when I break of the code specifically for movement into its own component that is a child of the root character node it can no longer find the TileMap that’s part of the main scene. How would I go about doing this?

can you provide more detail? some screenshots if you can as well

So this script is attacked to a node that is a child of the Player node in its own scene. It needs to get the TileMap node and I’m not sure how to go about doing that.

How is it attached to a child of Player? I don’t see any childs of Player in your Scene, if you attached it by script can you show us that script pls as well?

This is the Player scene. That movement script I posted above is on the MovementComponent node in this scene

I see, is there a reason why your Player is an Area2D Node? it is usually a CharacterBody2D node

I don’t have any plans on using any physics cause its going to be a grid turn-based game so I’m only going to use area checks. Are there any reasons that I should be using the CharacterBody?

Ah I can’t help you there never done grid movement, I found this video tho he uses a characterbody2d. You don’t have to use the physics_process

Yeah, the movement Isn’t the issue. I know the code works I just need to know how to get the MovementComponent script to access the TileMap for it to work properly.