From 75759659ee006afeabe9336accdb1e3a57c11f69 Mon Sep 17 00:00:00 2001 From: Luke Hubmayer-Werner Date: Tue, 5 Jan 2021 00:03:36 +1030 Subject: [PATCH] Hide receptors inside menu --- main.tscn | 3 +++ scripts/Menu.gd | 1 + scripts/Receptors.gd | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/main.tscn b/main.tscn index f8f6248..d3e8d88 100644 --- a/main.tscn +++ b/main.tscn @@ -99,9 +99,12 @@ script = ExtResource( 3 ) [node name="Receptors" type="MeshInstance2D" parent="."] material = SubResource( 1 ) +position = Vector2( 0, 1080 ) mesh = SubResource( 2 ) script = ExtResource( 5 ) +[node name="Tween" type="Tween" parent="Receptors"] + [node name="NoteHandler" type="Node2D" parent="."] script = ExtResource( 6 ) diff --git a/scripts/Menu.gd b/scripts/Menu.gd index 430f5c3..343dc10 100644 --- a/scripts/Menu.gd +++ b/scripts/Menu.gd @@ -385,6 +385,7 @@ func _draw(): ScoreText.show() func set_menu_mode(mode): + $'../Receptors'.fade(mode == MenuMode.GAMEPLAY) menu_mode_prev = menu_mode menu_mode = mode menu_mode_prev_fade_timer = menu_mode_prev_fade_timer_duration diff --git a/scripts/Receptors.gd b/scripts/Receptors.gd index 6f45e26..443db9e 100644 --- a/scripts/Receptors.gd +++ b/scripts/Receptors.gd @@ -147,3 +147,8 @@ func _ready(): # if not Engine.editor_hint: # set_receptor_positions(sin(OS.get_ticks_msec()*0.001*0.0125*PI)*PI) # update() + +func fade(visible: bool): +# $Tween.interpolate_property(self, "modulate", modulate, Color(1.0, 1.0, 1.0, float(visible)), 1.0) + $Tween.interpolate_property(self, "position", position, Vector2(0.0, float(!visible)*1080), 1.0) + $Tween.start()