how to know if player is in contact with a specific tile in godot

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By hiruy

I want to make a 2d game with lava but I don’t know if the player is in contact with a specific tile in a tilemap. in the tile map, there are just sprites with textures.
my code if it helps:

extends KinematicBody2D

signal health_updated(health)
signal killed()

const UP = Vector2(0,-1)
const GRAVITY = 30
const MAXFALLSPEED = 5500
const MAXSPEED = 800
const jumpforce = 1675
const accel = 20

export (float) var max_health = 10
onready var health = max_health setget _set_health
onready var invulnerability_timer = $invulnerabilityTimer

var motion = Vector2()
var facing_right = true
var isAttacking = false;

func _ready():
pass

func _physics_process(delta):

motion.y += GRAVITY
if motion.y > MAXFALLSPEED:
	motion.y = MAXFALLSPEED
	
if facing_right == true:
	$Sprite.scale.x = 10
else:
	$Sprite.scale.x = -10
motion.x = clamp(motion.x,-MAXSPEED,MAXSPEED)


if Input.is_action_pressed("right") && isAttacking == false:
	motion.x += accel
	facing_right = true
	get_node("attackarea").position = Vector2(25, 1)
	$AnimationPlayer.play("run")
elif Input.is_action_pressed("left") && isAttacking == false:
	motion.x -= accel
	get_node("attackarea").position = Vector2(-225, 1)
	facing_right = false
	$AnimationPlayer.play("run")
else:
	motion.x = 0;
	if isAttacking == false:
		$AnimationPlayer.play("idle")
if is_on_floor():
	if Input.is_action_just_pressed("jump"):
		motion.y = -jumpforce
if !is_on_floor():
	if motion.y < 0:
		$AnimationPlayer.play("jump")
	elif motion.y > 0:
		$AnimationPlayer.play("fall")

if Input.is_action_just_pressed("attack"):
	$AnimationPlayer.play("attack")
	isAttacking = true;
	$attackarea/attackcolision.disabled = false;
motion = move_and_slide(motion, UP)

func damage(amount):
if invulnerability_timer.is_stopped():
invulnerability_timer.start()
_set_health(health - amount)
$AnimationPlayer.play(“damage”)
$AnimationPlayer.queue(“flash”)

func kill():
pass

func _set_health(value):
var prev_health = health
health = clamp(value, 0, max_health)
if health != prev_health:
emit_signal(“health_updated”, health)
if health == 0:
kill()
emit_signal(“killed”)

func _on_invulnerabilityTimer_timeout():
$AnimationPlayer.play(“rest”)

func _on_AnimationPlayer_animation_finished(attack):
$attackarea/attackcolision.disabled = true;
isAttacking = false;

:bust_in_silhouette: Reply From: Inces

tilemap has world_to_map function, You can use it to translate your players real position into a snapped cell position. You can then recognize what tile is in this cell position using get_cellmethod. It will return index of the tile in your tileset.