0 votes

How can I get the tile name when colliding with it?
This is the name of my tile:

enter image description here
This is the code which is inside a KinematicBody2D:

func _on_Collision_interacitons_body_entered(body):

    var type = body.tile_get_name()


But when I try to run the game I get the following error:
enter image description here

Godot version 3.2.3.stable.official
in Engine by (77 points)

1 Answer

–1 vote

you are trying to get a a tile name from a kinematic body (unless you checked "kinematic" in the tilemap inspector

try this to get names:

func _on_Collision_interacitons_body_entered(body):

but tilemaps are not bodies unless specified in the inspector (collisionusekinematic)

by (367 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.