From a34eb5b2d96e60646a7e85947373fea61a70bc5c Mon Sep 17 00:00:00 2001 From: Ryan Reed Date: Mon, 24 Mar 2025 19:03:37 -0400 Subject: [PATCH] Creating a few functions --- scenes/world/world.gd | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scenes/world/world.gd b/scenes/world/world.gd index d8c3eda..507fb90 100644 --- a/scenes/world/world.gd +++ b/scenes/world/world.gd @@ -17,6 +17,18 @@ func _ready() -> void: EntityManager.reset_world.connect(_on_reset_world) EntityManager.spawn_player.connect(_spawn_player) + clear_world() + create_world() + + +func clear_world() -> void: + for block: Block in blocks_container.get_children(): + block.queue_free() + + for block: DroppedBlock in dropped_items_container.get_children(): + block.queue_free() + +func create_world() -> void: _initialize_ground() _create_test_blocks() @@ -70,8 +82,4 @@ func _initialize_ground() -> void: ## Generally for resetting/emptying the world to allow for load_game func _on_reset_world() -> void: - for block: Block in blocks_container.get_children(): - block.queue_free() - - for block: DroppedBlock in dropped_items_container.get_children(): - block.queue_free() + clear_world()