So for my first game in godot I've been making a platformer. I have an area2d with a death script collisionshape2d as a child. The code for the script is
(sorry I can't make the sample code feature work)
extends Area2D
var deaths = 0
func onbodyentered(body :PhysicsBody2D):
deaths = deaths + 1
print(deaths)
gettree().changescenetofile("res://lv_1.tscn")
This resets the player as I want, but what's printed in the console is always 1, no matter how many times the player dies. What am I doing wrong?