[HELP] Invalid call. Nonexistent function 'time' in base 'KinematicBody2D (enimy.gd)'.

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

I am trying to play a death animation when the player hits the enemy. But I am getting this error Invalid call. Nonexistent function ‘die’ in base ‘KinematicBody2D (enimy.gd)’.
even though the player’s script have a function.HELP! PLS

    
func _on_Area2D2_body_entered(body):
	body.die()

Die function in player:


func die():
	var player = load("res://Player.tscn")
	player.get_node("AnimationPlayer").play("die")
	$Timer.start()
:bust_in_silhouette: Reply From: Inces

You post die() function of player, but You call die() of enemy in your code. Provide enemy with die() function. It is the enemy that is being hit, so it should handle his death by himself, with his own animation player.