I there, I'm pretty new to GDScript and coding in general. I was sailing along smoothly until I hit a major snag with the death function and haven't been able to find any answers anywhere. Any help would be appreciated, even just directing me to a tutorial or thread you know of.
So I have a KinematicBody2D Player character that I want to die when he runs into a spike. I've set the Spikes up as Area2D nodes.
Now, ideally, I'd like a die() function in my Player's code that stops the game, plays a sound, plays a death animation in it's AnimatedSprite node and brings up a gameover screen.
I've tried a few different times, creating die() functions, signaling form the spike to the player, etc. But nothing seems to be working.
I have this die() function in my player's code, just to see if it's connecting.
func die():
print ("ded")
$AnimatedSprite.play("die")
Then I have a signal from the pike to the level both the spike and the player are in that calls
func _on_Spike_area_entered(area):
$Player.die()
When I run the scene, nothing happens at all when I pass through the spike.