From 67a490ab508ea070639033626c6d0cceb301a0c3 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Sun, 2 Feb 2020 03:48:07 -0500 Subject: [PATCH] Improve pause demo --- misc/pause/pause_button.gd | 12 ++++++------ misc/pause/spinpause.gd | 10 ---------- misc/pause/spinpause.tscn | 14 +++++++------- 3 files changed, 13 insertions(+), 23 deletions(-) delete mode 100644 misc/pause/spinpause.gd diff --git a/misc/pause/pause_button.gd b/misc/pause/pause_button.gd index 65a09dee..8c450f4b 100644 --- a/misc/pause/pause_button.gd +++ b/misc/pause/pause_button.gd @@ -1,16 +1,16 @@ extends Button func _ready(): - #This ensures that this Node won't be paused, allowing it to - #process even when the SceneTree is paused. Without that it would - #not be able to unpause the game. Note that you can set this through - #the inspector as well + # This ensures that this Node won't be paused, allowing it to + # process even when the SceneTree is paused. Without that it would + # not be able to unpause the game. Note that you can set this through + # the inspector as well. pause_mode = Node.PAUSE_MODE_PROCESS func _toggled(button_pressed): - #Pause or unpause the SceneTree based on whether the button is - #toggled on or off + # Pause or unpause the SceneTree based on whether the button is + # toggled on or off. get_tree().paused = button_pressed if button_pressed: text = "Unpause" diff --git a/misc/pause/spinpause.gd b/misc/pause/spinpause.gd deleted file mode 100644 index 6bb74c9d..00000000 --- a/misc/pause/spinpause.gd +++ /dev/null @@ -1,10 +0,0 @@ -extends Spatial - -func _on_pause_pressed(): - get_node("pause_popup").set_exclusive(true) - get_node("pause_popup").popup() - get_tree().set_pause(true) - -func _on_unpause_pressed(): - get_node("pause_popup").hide() - get_tree().set_pause(false) diff --git a/misc/pause/spinpause.tscn b/misc/pause/spinpause.tscn index 421c5a20..613b8587 100644 --- a/misc/pause/spinpause.tscn +++ b/misc/pause/spinpause.tscn @@ -8,7 +8,7 @@ length = 10.0 loop = true tracks/0/type = "value" -tracks/0/path = NodePath("cube:rotation_degrees") +tracks/0/path = NodePath("Cube:rotation_degrees") tracks/0/interp = 1 tracks/0/loop_wrap = true tracks/0/imported = false @@ -20,26 +20,26 @@ tracks/0/keys = { "values": [ Vector3( 0, 0, 0 ), Vector3( 0, -360, 0 ) ] } -[node name="pause_scene" type="Spatial"] +[node name="PauseScene" type="Spatial"] -[node name="cube" type="MeshInstance" parent="."] +[node name="Cube" type="MeshInstance" parent="."] mesh = SubResource( 1 ) material/0 = null -[node name="camera" type="Camera" parent="."] +[node name="Camera" type="Camera" parent="."] transform = Transform( 0.571594, 0.275303, -0.772974, 0, 0.942035, 0.335515, 0.820537, -0.191779, 0.538461, -5.59754, 2.75935, 4.01344 ) fov = 74.0 near = 0.1 -[node name="anim" type="AnimationPlayer" parent="."] +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] autoplay = "spin" anims/spin = SubResource( 2 ) -[node name="spot" type="SpotLight" parent="."] +[node name="SpotLight" type="SpotLight" parent="."] transform = Transform( 0.792992, 0.251051, -0.555101, 0, 0.911149, 0.412078, 0.609232, -0.326775, 0.722534, -3.05357, 1.80053, 3.64099 ) spot_range = 6.0 -[node name="pause_button" type="Button" parent="."] +[node name="PauseButton" type="Button" parent="."] pause_mode = 2 anchor_left = 0.5 anchor_top = 0.5