Need help with tilemap refrencing errior

Is your player a area2d?

Screenshot 2024-08-09 145232
yeah hitbox is an area 2d but the actual player is a characterbody2d

Then you have to put this area in the group in your player.gd-script:

func _ready():
    $EVERHITBOX.add_to_group("EVERHITBOX")

and remove “add_to_group” from your physics_process-method since physics_process is called ~60times per second and you only need to add it once

Ok this is weird, after i added that the same error from before ending up showing up?

does the player spawn in range of a tile_breaker?

No the tile breaker is a bit far from where the player spawns, in the main scene

so it doesnt crash when you start, just when you walk in range right?
Can you run your scene and then go to the scene tree in your editor and click on “remote” then go through the remote scene tree until you find the tilemap and your “TileBreaker” and make a screenshot

Screenshot 2024-08-09 154901

hm, do you still have the tilemap-script that says this?:

func _ready():
    Global.tilemap = self

i deleted that from the tilemap in my main scene a miniute ago because an error had occured

Well you have to set the Global-variable before the tilebreaker interaction happens


ths error ending up popping up after i put this in

again, there has to be “extends TileMap” at the top


ok thank you, everything seems to be almost working properly but the actual tile wont delete its self but the particle effect seems to work and destroy itself after its lifetime is over

Are you sure you selected the correct layer (“0”)?

yeah i changed it to 1 and it still seems to be happening?

maybe i didnt select the write layer not sure

ok yeah the main tilemap layer is 0 and the specific tile should break when the collision happens but it just destory’s the collision and plays the particale effect

Judging from this screenshot, the collision-box of the tiles cant be entered since its inside the tile. Just the top tilebreaker gets activated, but it doesnt have a tile behind it. The collisionbox has to reach out of the tile its supposed to destroy and then you also have to apply an offset on the “erase_cell” method

just wondering how would i do that with the current code now, how would i be able to reach out of the tile my collision box is supposed to destroy so i can destroy the tilebreaker and the tile? and how would i apply an offset to my erase cell method? sorry if im asking alot of questions