I am a beginner. I created a simple 2d platformer game and I am trying to add coins. Whenever the player dies, get_tree().change_scene(level scene)
is run to reset the scene and the player's pos. However, when the player dies and the scene is reset, the coins reappear. I would like the player to go back to the original pos but the coins that have been collected stay collected and don't reappear.
*The coins are children of the level scene
current code for the coins:
extends Area2D
func _on_Coin_body_entered(body):
queue_free()
Scene tree looks like:
-Level
-> -Coin(Area2D)
-> -> -AnimatedSprite
-> -> -CollisionShape
Thanks