Need help with tilemap refrencing errior


Ok the script is working now but the script were i try and reference the variable (my tilemap script), is showing me that it isnt properly finding the tilemap in the right scene

You shouldnt access nodes like this from Global-scripts


Mb i just realized i deleted that from my global script but in my tilemap script this errors appearing on line four

put this in global-script:

var tilemap: TileMap

ok thank you alot, it seems like almost everything is fixed, but the main thing i was trying to do is make the tiles breakable upon the players contact no errors are occuring but the tiles arent breaking

Does the _on_area_entered-signal trigger? (Does “broke!” get printed out)

no not at all

Can you put a print before the if-statement

func _on_area_entered(area):
    print("Entered Area")
    if area.is_in_group("EVERHITBOX")

And test if it prints?

sorry for the late response, i really appreciate you helping me by the way. nothings coming up though when i print it

But you loaded a scene which should contain them right?

yes, the collision is showing as seen, but whenever the players htibox enters the collision shape it dosent work

Are the collision-mask and layer setup correctly?




everything seems correct?


ok good news very good news, i didnt even realize godot 4 had a diffent button to see printed messages but it does work, however still the tileblocks still arent breaking which may still be a issue with the tile breaker collision not disappearing.

Is your detection-area in the “EVERHITBOX”-Group?

wdym its detecting it with its printed message i dont know what you mean by group though

In your code you are testing if the area the TileBreaker is colliding with is in the group “EVERHITBOX”:

func _on_area_entered(area):
    print("Entered Area")
    if area.is_in_group("EVERHITBOX"): # This line

This means this only breaks the tiles when the colliding area is in this group.
You can add nodes to groups in the inspector or in code:

area.add_to_group("EVERHITBOX")

where would i put that in my code or in the inspector?

I assume the area is supposed to be the player right? if so, then put it in your player script


problem i ran into while doing that is that it kept saying that area isnt declared in the current scope so when i took off the area it ended up working