Godot Version
Godot 4
Question
I want my Area2d to disapear when its touch the Tilemap
Use the on_body_entered method. The tilemap is considered a body
Already try that one but still not working
Are the collision-mask and collision-layer set up correctly?
Idk the collision mask and layer from tile map is 1 and from area is also 1.
And the tiles of the tileset have collision?
Yes they have
So tiles have collision, tileset collision-layer is set to 1 and area2d collision-mask is set to 1 and area2d body_entered-signal is connected but doesnt emit?
Yeaa idk whyy
Okay if this is all true what you are saying then i would need to see an example of whats happening. Can you show the body_entered-method?
extends TileMap
@onready var apple = $“…/Apple”
func _on_apple_area_entered(area):
print(“enter”)
apple.animation = “Splash”
await get_tree().create_timer(0.2).timeout
apple.queue_free()
thiss??
And it doesnt print “enter” when they collide?
nope its doesnt
can you make a screenshot of your area2d-scene with the collision-property open?
Theres no signal connection-symbol. click on “Node” on the right side
oh that when i click connect i cant connect it to the tilemap script
you only need to connect it to the apple script. And put this code in the apple-script:
func _on_body_entered(body):
print(“enter”)
animated_sprite.animation = “Splash”
await get_tree().create_timer(0.2).timeout
queue_free()
its still not working. my apple scene is not in the game scene so i cant connect the apple scene with the tilemap script. and if i add the apple to the game scene the game dont work
You dont need to connect it to the tilemap-script. Connect the area2d.body_entered-signal to the Apple-script in the apple-scene