mirror of
https://github.com/Nokorpo/LibreAim.git
synced 2025-06-09 09:35:16 +09:00
Add end game screen
This commit is contained in:
parent
edc1eb9cb9
commit
f5301c5419
5 changed files with 90 additions and 3 deletions
|
@ -16,6 +16,7 @@ bg_color = Color(0.16, 0.16, 0.16, 1)
|
|||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ijt1d"]
|
||||
content_margin_left = 50.0
|
||||
content_margin_top = 25.0
|
||||
content_margin_right = 50.0
|
||||
content_margin_bottom = 25.0
|
||||
bg_color = Color(0.2, 0.2, 0.2, 1)
|
||||
|
||||
|
|
7
scenes/game_world/end_game_canvas.gd
Normal file
7
scenes/game_world/end_game_canvas.gd
Normal file
|
@ -0,0 +1,7 @@
|
|||
extends Control
|
||||
|
||||
func set_score(score: int) -> void:
|
||||
$Score.text = "Score: " + str(score)
|
||||
|
||||
func _on_button_pressed():
|
||||
get_tree().change_scene_to_file("res://scenes/main_menu/main_menu.tscn")
|
|
@ -21,7 +21,11 @@ func _process(_delta) -> void:
|
|||
func _on_timer_timeout() -> void:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
DataManager.save_high_score(Global.current_gamemode.id, count_kills)
|
||||
get_tree().change_scene_to_file("res://scenes/main_menu/main_menu.tscn")
|
||||
timer.stop()
|
||||
$Player.queue_free()
|
||||
$CanvasLayer/EndGameCanvas.set_score(count_kills)
|
||||
$CanvasLayer/GameplayUI.visible = false
|
||||
$CanvasLayer/EndGameCanvas.visible = true
|
||||
|
||||
func _on_target_destroyed() -> void:
|
||||
$DestroyedSound.pitch_scale = randf_range(0.95, 1.05)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=30 format=3 uid="uid://cdbhv0p0jfr75"]
|
||||
[gd_scene load_steps=32 format=3 uid="uid://cdbhv0p0jfr75"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game_world/game_world.gd" id="1_4pv4x"]
|
||||
[ext_resource type="Material" uid="uid://dsqe2mx1kgicf" path="res://assets/images/mat_filldummy.tres" id="2_ldkna"]
|
||||
|
@ -11,6 +11,7 @@
|
|||
[ext_resource type="Theme" uid="uid://caf1fphx2xqt0" path="res://assets/themes/main_menu.tres" id="7_gwa7l"]
|
||||
[ext_resource type="Texture2D" uid="uid://cmrheauks0nru" path="res://assets/images/icons/cross.svg" id="8_6pksd"]
|
||||
[ext_resource type="Script" path="res://scenes/game_world/mouse_capture.gd" id="10_vngrv"]
|
||||
[ext_resource type="Script" path="res://scenes/game_world/end_game_canvas.gd" id="12_w3gpo"]
|
||||
[ext_resource type="AudioStream" uid="uid://c1ons03xoggga" path="res://scenes/enemies/beep.ogg" id="12_xv1t2"]
|
||||
[ext_resource type="Script" path="res://scenes/game_world/destroyed_sound.gd" id="13_mss18"]
|
||||
|
||||
|
@ -148,6 +149,9 @@ _data = {
|
|||
"idle": SubResource("Animation_8c12g")
|
||||
}
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ecmy3"]
|
||||
bg_color = Color(0, 0, 0, 0.588235)
|
||||
|
||||
[node name="World" type="Node3D"]
|
||||
script = ExtResource("1_4pv4x")
|
||||
|
||||
|
@ -466,6 +470,76 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
text = "Mouse captured is needed."
|
||||
|
||||
[node name="EndGameCanvas" type="Control" parent="CanvasLayer"]
|
||||
visible = false
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("7_gwa7l")
|
||||
script = ExtResource("12_w3gpo")
|
||||
|
||||
[node name="Panel" type="Panel" parent="CanvasLayer/EndGameCanvas"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_ecmy3")
|
||||
|
||||
[node name="Label" type="Label" parent="CanvasLayer/EndGameCanvas"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -120.5
|
||||
offset_top = -209.0
|
||||
offset_right = 120.5
|
||||
offset_bottom = -151.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_font_sizes/font_size = 42
|
||||
text = "GAME OVER"
|
||||
|
||||
[node name="Score" type="Label" parent="CanvasLayer/EndGameCanvas"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -120.0
|
||||
offset_top = -68.0
|
||||
offset_right = 121.0
|
||||
offset_bottom = -10.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_font_sizes/font_size = 42
|
||||
text = "Score: 0"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Button" type="Button" parent="CanvasLayer/EndGameCanvas"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -227.5
|
||||
offset_top = 57.0
|
||||
offset_right = 227.5
|
||||
offset_bottom = 160.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_default_cursor_shape = 2
|
||||
text = "Back to main menu"
|
||||
icon = ExtResource("7_7rabg")
|
||||
|
||||
[node name="DestroyedSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("12_xv1t2")
|
||||
script = ExtResource("13_mss18")
|
||||
|
@ -475,3 +549,4 @@ script = ExtResource("13_mss18")
|
|||
[connection signal="pressed" from="CanvasLayer/PauseManager/Pause/Buttons/Resume" to="CanvasLayer/PauseManager" method="_on_resume_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/PauseManager/Pause/Buttons/Menu" to="CanvasLayer/PauseManager" method="_on_menu_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/MouseCapturedRequest/MouseCapturedNeeded" to="CanvasLayer/MouseCapturedRequest" method="_on_mouse_captured_needed_pressed"]
|
||||
[connection signal="pressed" from="CanvasLayer/EndGameCanvas/Button" to="CanvasLayer/EndGameCanvas" method="_on_button_pressed"]
|
||||
|
|
|
@ -24,7 +24,7 @@ func _ready() -> void:
|
|||
camera.fov = DataManager.set_parameter_if_exists(category, camera.fov, "camera_fov")
|
||||
mouse_sensitivity = user_sensitivity * conversion_sensitivity
|
||||
|
||||
func _input(event) -> void:
|
||||
func _input(event) -> void:
|
||||
if event is InputEventMouseMotion:
|
||||
rotate_y(deg_to_rad(-event.relative.x * mouse_sensitivity))
|
||||
camera.rotate_x(deg_to_rad(-event.relative.y * mouse_sensitivity))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue