I am working on a breakout game and I need to reload the scene when the ball hits a wall. Here is the code:
extends RigidBody2D
func _ready():
set_fixed_process(true)
func _fixed_process(delta):
var caramizi = get_colliding_bodies()
for caramida in caramizi:
if caramida.is_in_group("caramida"):
caramida.queue_free()
elif caramida.is_in_group("die"):
#reload the scene
pass
How to reload the scene?
The SceneTree has a reload_current_scene method. You should be able to use it with:
http://docs.godotengine.org/en/stable/classes/class_scenetree.html