how to make a death block

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

So I’m trying to make an Area2D a kind of ‘death block’ where if the player touches it the scene is reset, the player is the only moving aspect in the scene and its name is ‘Player’. What code would i need to use, and how do i make that code work i.e. do i need and functions or variables

:bust_in_silhouette: Reply From: kidscancode

Connect the body_entered or area_entered signal (whichever type your Player node is) of the “death block”. Then you can call SceneTree.reload_current_scene() to cause a reload.

func _on_DeathBlock_body_entered(body):
    get_tree().reload_current_scene()