mirror of
https://codeberg.org/Melon-Bread/Comets.gd.git
synced 2024-11-28 15:08:20 -05:00
Allow the game over screen to grab proper focus when it opens
This commit is contained in:
parent
b8cdc82888
commit
914a6e4010
@ -1,18 +1,10 @@
|
|||||||
[gd_scene load_steps=8 format=3 uid="uid://bdarunpk3c2eh"]
|
[gd_scene load_steps=6 format=3 uid="uid://bdarunpk3c2eh"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://scripts/game.gd" id="1_6727i"]
|
[ext_resource type="Script" path="res://scripts/game.gd" id="1_6727i"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cbo47ftx0vcro" path="res://scenes/ship.tscn" id="1_esyqo"]
|
[ext_resource type="PackedScene" uid="uid://cbo47ftx0vcro" path="res://scenes/ship.tscn" id="1_esyqo"]
|
||||||
[ext_resource type="FontFile" uid="uid://bkcxbtx1vcj8w" path="res://assets/fonts/Color Basic.otf" id="2_gwtm0"]
|
[ext_resource type="FontFile" uid="uid://bkcxbtx1vcj8w" path="res://assets/fonts/Color Basic.otf" id="2_gwtm0"]
|
||||||
[ext_resource type="PackedScene" uid="uid://0yktrbyp6cr3" path="res://scenes/game_over_screen.tscn" id="3_yy075"]
|
[ext_resource type="PackedScene" uid="uid://0yktrbyp6cr3" path="res://scenes/game_over_screen.tscn" id="3_yy075"]
|
||||||
[ext_resource type="Texture2D" uid="uid://chuygpyfe3y10" path="res://assets/img/star.png" id="4_jc3cg"]
|
[ext_resource type="PackedScene" uid="uid://cemhlom425afn" path="res://scenes/stars.tscn" id="4_064lo"]
|
||||||
|
|
||||||
[sub_resource type="Curve" id="Curve_8qyxb"]
|
|
||||||
_data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.606742, 1), 0.052866, 0.052866, 0, 0, Vector2(1, 0.615385), 0.0, 0.0, 0, 0]
|
|
||||||
point_count = 3
|
|
||||||
|
|
||||||
[sub_resource type="Gradient" id="Gradient_rnjki"]
|
|
||||||
offsets = PackedFloat32Array(0, 0.406667, 0.84)
|
|
||||||
colors = PackedColorArray(0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1)
|
|
||||||
|
|
||||||
[node name="Game" type="Node2D"]
|
[node name="Game" type="Node2D"]
|
||||||
script = ExtResource("1_6727i")
|
script = ExtResource("1_6727i")
|
||||||
@ -50,15 +42,7 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
color = Color(0, 0, 0, 1)
|
color = Color(0, 0, 0, 1)
|
||||||
|
|
||||||
[node name="Stars" type="CPUParticles2D" parent="Background"]
|
[node name="Stars" parent="Background" instance=ExtResource("4_064lo")]
|
||||||
amount = 64
|
|
||||||
lifetime = 5.0
|
|
||||||
texture = ExtResource("4_jc3cg")
|
|
||||||
emission_shape = 3
|
|
||||||
emission_rect_extents = Vector2(1200, 700)
|
|
||||||
gravity = Vector2(0, 0)
|
|
||||||
scale_amount_curve = SubResource("Curve_8qyxb")
|
|
||||||
color_ramp = SubResource("Gradient_rnjki")
|
|
||||||
|
|
||||||
[node name="Ship" parent="." instance=ExtResource("1_esyqo")]
|
[node name="Ship" parent="." instance=ExtResource("1_esyqo")]
|
||||||
z_index = 1
|
z_index = 1
|
||||||
|
@ -99,5 +99,6 @@ theme_override_fonts/font = ExtResource("1_lbk85")
|
|||||||
text = "quit
|
text = "quit
|
||||||
"
|
"
|
||||||
|
|
||||||
|
[connection signal="visibility_changed" from="." to="." method="_on_visibility_changed"]
|
||||||
[connection signal="pressed" from="Panel/RetryButton" to="." method="_on_retry_button_pressed"]
|
[connection signal="pressed" from="Panel/RetryButton" to="." method="_on_retry_button_pressed"]
|
||||||
[connection signal="pressed" from="Panel/QuitButton" to="." method="_on_quit_button_pressed"]
|
[connection signal="pressed" from="Panel/QuitButton" to="." method="_on_quit_button_pressed"]
|
||||||
|
@ -35,7 +35,6 @@ func game_over() -> void:
|
|||||||
# Wait 1 second before showing the game over screen for "dramatic" effect
|
# Wait 1 second before showing the game over screen for "dramatic" effect
|
||||||
await get_tree().create_timer(1.0).timeout
|
await get_tree().create_timer(1.0).timeout
|
||||||
$UI/GameOverScreen.visible = true
|
$UI/GameOverScreen.visible = true
|
||||||
# TODO: Set focus on one of the buttons once the game over screen when shown
|
|
||||||
|
|
||||||
func increase_score(comet_size : int) -> void:
|
func increase_score(comet_size : int) -> void:
|
||||||
# We add one since comet_size starts count at 0
|
# We add one since comet_size starts count at 0
|
||||||
@ -46,3 +45,6 @@ func update_ui()-> void:
|
|||||||
# Label strings must be all caps for font to render proper
|
# Label strings must be all caps for font to render proper
|
||||||
$UI/Score.text = "SCORE: " + str(score)
|
$UI/Score.text = "SCORE: " + str(score)
|
||||||
$UI/Level.text = "LEVEL: " + str(level)
|
$UI/Level.text = "LEVEL: " + str(level)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,5 +4,7 @@ func _on_retry_button_pressed() -> void:
|
|||||||
get_tree().change_scene_to_file("res://scenes/game.tscn")
|
get_tree().change_scene_to_file("res://scenes/game.tscn")
|
||||||
|
|
||||||
func _on_quit_button_pressed() -> void:
|
func _on_quit_button_pressed() -> void:
|
||||||
# TODO: Go to title screen instead of killing the game
|
get_tree().change_scene_to_file("res://scenes/title_screen.tscn")
|
||||||
get_tree().quit()
|
|
||||||
|
func _on_visibility_changed() -> void:
|
||||||
|
$Panel/RetryButton.grab_focus()
|
||||||
|
Loading…
Reference in New Issue
Block a user