From 39b28d35546ee857b6831f3712aa1848df5f28af Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Fri, 15 Sep 2023 22:45:02 -0400 Subject: [PATCH] reset stains on map change --- autoloads/game.gd | 1 + autoloads/stain_layer.gd | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/autoloads/game.gd b/autoloads/game.gd index 8023087..1a687f6 100644 --- a/autoloads/game.gd +++ b/autoloads/game.gd @@ -148,6 +148,7 @@ func change_map(map: PackedScene) -> void: Save.current_file.save_to_file() # clear clear_collectibles() + StainLayer.reset() #Loop is so no more than one level is loaded at a time SceneManager.current_scene = map.instance() diff --git a/autoloads/stain_layer.gd b/autoloads/stain_layer.gd index f2f4ce4..c6d5e3f 100644 --- a/autoloads/stain_layer.gd +++ b/autoloads/stain_layer.gd @@ -15,3 +15,9 @@ func _process(delta: float) -> void: func add_stain(stain: Node2D) -> void: viewport.add_child(stain) viewport.render_target_update_mode = Viewport.UPDATE_ONCE + + +func reset() -> void: + for child in viewport.get_children(): + child.queue_free() + viewport.render_target_update_mode = Viewport.UPDATE_ONCE