Compare commits
	
		
			2 Commits
		
	
	
		
			3c90e6a26c
			...
			3f9e261a53
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 3f9e261a53 | |||
| 40d09e5b46 | 
| @@ -12,6 +12,7 @@ var gravity = ProjectSettings.get_setting("physics/3d/default_gravity") | ||||
| @onready var head = $Head | ||||
| @onready var camera = $Head/PlayerCamera | ||||
| @onready var player_debug = $Head/PlayerCamera/PlayerDebug | ||||
| @onready var overlay_fps = $Head/PlayerCamera/OverlayFPS | ||||
| @onready var player_stats = $PlayerStats | ||||
| @onready var anim_player = $AnimationPlayer | ||||
| @onready var muzzle_flash = $Head/PlayerCamera/pistol/MuzzleFlash | ||||
| @@ -39,6 +40,13 @@ func _unhandled_input(event: InputEvent) -> void: | ||||
| 	if Input.is_action_just_pressed("debug_overlay"): | ||||
| 		player_debug.visible = !player_debug.visible | ||||
| 	 | ||||
| 	if Input.is_action_just_pressed("overlay_fps"): | ||||
| 		if !overlay_fps.visible: | ||||
| 			overlay_fps.visible = true | ||||
| 		elif !overlay_fps.advanced_output: | ||||
| 			overlay_fps.advanced_output = true | ||||
| 		else: | ||||
| 			overlay_fps.advanced_output = false | ||||
|  | ||||
| func _physics_process(delta: float) -> void: | ||||
| 	if not is_on_floor(): | ||||
|   | ||||
							
								
								
									
										13
									
								
								game/main_menu.gd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								game/main_menu.gd
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,13 @@ | ||||
| extends Control | ||||
|  | ||||
|  | ||||
| func _on_play_pressed() -> void: | ||||
| 	get_tree().change_scene_to_file("res://world.tscn") | ||||
|  | ||||
|  | ||||
| func _on_options_pressed() -> void: | ||||
| 	get_tree().change_scene_to_file("res://options_menu.tscn") | ||||
|  | ||||
|  | ||||
| func _on_quit_pressed() -> void: | ||||
| 	get_tree().quit(0) | ||||
							
								
								
									
										1
									
								
								game/main_menu.gd.uid
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								game/main_menu.gd.uid
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| uid://bsx7nporxaoa6 | ||||
							
								
								
									
										36
									
								
								game/main_menu.tscn
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								game/main_menu.tscn
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,36 @@ | ||||
| [gd_scene load_steps=2 format=3 uid="uid://3pysj67x88uw"] | ||||
|  | ||||
| [ext_resource type="Script" uid="uid://bsx7nporxaoa6" path="res://main_menu.gd" id="1_06t4h"] | ||||
|  | ||||
| [node name="MainMenu" type="Control"] | ||||
| layout_mode = 3 | ||||
| anchors_preset = 15 | ||||
| anchor_right = 1.0 | ||||
| anchor_bottom = 1.0 | ||||
| grow_horizontal = 2 | ||||
| grow_vertical = 2 | ||||
| script = ExtResource("1_06t4h") | ||||
|  | ||||
| [node name="MarginContainer" type="MarginContainer" parent="."] | ||||
| layout_mode = 0 | ||||
| offset_right = 40.0 | ||||
| offset_bottom = 40.0 | ||||
|  | ||||
| [node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] | ||||
| layout_mode = 2 | ||||
|  | ||||
| [node name="Play" type="Button" parent="MarginContainer/VBoxContainer"] | ||||
| layout_mode = 2 | ||||
| text = "Play Game" | ||||
|  | ||||
| [node name="Options" type="Button" parent="MarginContainer/VBoxContainer"] | ||||
| layout_mode = 2 | ||||
| text = "Options" | ||||
|  | ||||
| [node name="Quit" type="Button" parent="MarginContainer/VBoxContainer"] | ||||
| layout_mode = 2 | ||||
| text = "Quit" | ||||
|  | ||||
| [connection signal="pressed" from="MarginContainer/VBoxContainer/Play" to="." method="_on_play_pressed"] | ||||
| [connection signal="pressed" from="MarginContainer/VBoxContainer/Options" to="." method="_on_options_pressed"] | ||||
| [connection signal="pressed" from="MarginContainer/VBoxContainer/Quit" to="." method="_on_quit_pressed"] | ||||
							
								
								
									
										12
									
								
								game/options_menu.gd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								game/options_menu.gd
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| extends Control | ||||
|  | ||||
|  | ||||
| func _on_back_pressed() -> void: | ||||
| 	get_tree().change_scene_to_file("res://main_menu.tscn") | ||||
|  | ||||
|  | ||||
| func _on_check_button_toggled(toggled_on: bool) -> void: | ||||
| 	if toggled_on: | ||||
| 		DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN) | ||||
| 	else: | ||||
| 		DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) | ||||
							
								
								
									
										1
									
								
								game/options_menu.gd.uid
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								game/options_menu.gd.uid
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| uid://csr3f6vfeqim8 | ||||
							
								
								
									
										34
									
								
								game/options_menu.tscn
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								game/options_menu.tscn
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| [gd_scene load_steps=2 format=3 uid="uid://gu2cm1ekgftu"] | ||||
|  | ||||
| [ext_resource type="Script" uid="uid://csr3f6vfeqim8" path="res://options_menu.gd" id="1_lbr8e"] | ||||
|  | ||||
| [node name="OptionsMenu" type="Control"] | ||||
| layout_mode = 3 | ||||
| anchors_preset = 15 | ||||
| anchor_right = 1.0 | ||||
| anchor_bottom = 1.0 | ||||
| grow_horizontal = 2 | ||||
| grow_vertical = 2 | ||||
| script = ExtResource("1_lbr8e") | ||||
|  | ||||
| [node name="MarginContainer" type="MarginContainer" parent="."] | ||||
| layout_mode = 1 | ||||
| anchors_preset = 15 | ||||
| anchor_right = 1.0 | ||||
| anchor_bottom = 1.0 | ||||
| grow_horizontal = 2 | ||||
| grow_vertical = 2 | ||||
|  | ||||
| [node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] | ||||
| layout_mode = 2 | ||||
|  | ||||
| [node name="Back" type="Button" parent="MarginContainer/VBoxContainer"] | ||||
| layout_mode = 2 | ||||
| text = "Back" | ||||
|  | ||||
| [node name="CheckButton" type="CheckButton" parent="MarginContainer/VBoxContainer"] | ||||
| layout_mode = 2 | ||||
| text = "Fullscreen" | ||||
|  | ||||
| [connection signal="pressed" from="MarginContainer/VBoxContainer/Back" to="." method="_on_back_pressed"] | ||||
| [connection signal="toggled" from="MarginContainer/VBoxContainer/CheckButton" to="." method="_on_check_button_toggled"] | ||||
							
								
								
									
										25
									
								
								game/overlay_fps.gd
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								game/overlay_fps.gd
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| extends CanvasLayer | ||||
|  | ||||
| @onready var text = $RichTextLabel | ||||
| @onready var timer = $Timer | ||||
|  | ||||
| var advanced_output: bool = false | ||||
|  | ||||
| func _ready() -> void: | ||||
| 	visible = false | ||||
|  | ||||
| func _on_timer_timeout() -> void: | ||||
| 	text.clear() | ||||
| 	text.add_text("FPS: %s\n" % Engine.get_frames_per_second()) | ||||
| 	if advanced_output: | ||||
| 		var res = DisplayServer.window_get_size() | ||||
| 		text.add_text("res: %sx%s\n" % [res.x, res.y]) | ||||
| 		var device = RenderingServer.get_rendering_device() | ||||
| 		text.add_text("rendering_device: %s\n" % device.get_device_name()) | ||||
| 		text.add_text("%s\n" % device.get_perf_report()) | ||||
|  | ||||
| func _on_visibility_changed() -> void: | ||||
| 	if visible: | ||||
| 		timer.start() | ||||
| 	else: | ||||
| 		timer.stop() | ||||
							
								
								
									
										1
									
								
								game/overlay_fps.gd.uid
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								game/overlay_fps.gd.uid
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| uid://dfns2snn6qqpw | ||||
| @@ -1,10 +1,11 @@ | ||||
| [gd_scene load_steps=19 format=3 uid="uid://dkldpdufpl28x"] | ||||
| [gd_scene load_steps=20 format=3 uid="uid://dkldpdufpl28x"] | ||||
|  | ||||
| [ext_resource type="Script" uid="uid://5vty5riyfef2" path="res://Player.gd" id="1_4flbx"] | ||||
| [ext_resource type="Script" uid="uid://cad5seggccvp6" path="res://player_debug.gd" id="2_onrkg"] | ||||
| [ext_resource type="PackedScene" uid="uid://ditco83gy03gm" path="res://models/pistol.glb" id="3_hqtel"] | ||||
| [ext_resource type="Script" uid="uid://7ads6wescib" path="res://player_stats.gd" id="3_i3pqv"] | ||||
| [ext_resource type="Texture2D" uid="uid://cmldtn5n8a7vr" path="res://assets/textures/star_01.png" id="4_sweqy"] | ||||
| [ext_resource type="Script" uid="uid://dfns2snn6qqpw" path="res://overlay_fps.gd" id="5_2hs0m"] | ||||
|  | ||||
| [sub_resource type="CapsuleMesh" id="CapsuleMesh_fj7yv"] | ||||
|  | ||||
| @@ -42,6 +43,33 @@ material = SubResource("StandardMaterial3D_b26j0") | ||||
| size = Vector2(0.4, 0.4) | ||||
| orientation = 2 | ||||
|  | ||||
| [sub_resource type="Animation" id="Animation_sweqy"] | ||||
| length = 0.001 | ||||
| tracks/0/type = "value" | ||||
| tracks/0/imported = false | ||||
| tracks/0/enabled = true | ||||
| tracks/0/path = NodePath("Head/PlayerCamera/pistol:position") | ||||
| tracks/0/interp = 1 | ||||
| tracks/0/loop_wrap = true | ||||
| tracks/0/keys = { | ||||
| "times": PackedFloat32Array(0), | ||||
| "transitions": PackedFloat32Array(1), | ||||
| "update": 0, | ||||
| "values": [Vector3(0.492394, -0.353437, -0.607601)] | ||||
| } | ||||
| tracks/1/type = "value" | ||||
| tracks/1/imported = false | ||||
| tracks/1/enabled = true | ||||
| tracks/1/path = NodePath("Head/PlayerCamera/pistol:rotation") | ||||
| tracks/1/interp = 1 | ||||
| tracks/1/loop_wrap = true | ||||
| tracks/1/keys = { | ||||
| "times": PackedFloat32Array(0), | ||||
| "transitions": PackedFloat32Array(1), | ||||
| "update": 0, | ||||
| "values": [Vector3(0, 0.0417832, 0)] | ||||
| } | ||||
|  | ||||
| [sub_resource type="Animation" id="Animation_hqtel"] | ||||
| resource_name = "idle" | ||||
| length = 3.0 | ||||
| @@ -72,33 +100,6 @@ tracks/1/keys = { | ||||
| "values": [Vector3(0, 0.0417832, 0), Vector3(-0.133121, 0.0421564, -0.00559862)] | ||||
| } | ||||
|  | ||||
| [sub_resource type="Animation" id="Animation_sweqy"] | ||||
| length = 0.001 | ||||
| tracks/0/type = "value" | ||||
| tracks/0/imported = false | ||||
| tracks/0/enabled = true | ||||
| tracks/0/path = NodePath("Head/PlayerCamera/pistol:position") | ||||
| tracks/0/interp = 1 | ||||
| tracks/0/loop_wrap = true | ||||
| tracks/0/keys = { | ||||
| "times": PackedFloat32Array(0), | ||||
| "transitions": PackedFloat32Array(1), | ||||
| "update": 0, | ||||
| "values": [Vector3(0.492394, -0.353437, -0.607601)] | ||||
| } | ||||
| tracks/1/type = "value" | ||||
| tracks/1/imported = false | ||||
| tracks/1/enabled = true | ||||
| tracks/1/path = NodePath("Head/PlayerCamera/pistol:rotation") | ||||
| tracks/1/interp = 1 | ||||
| tracks/1/loop_wrap = true | ||||
| tracks/1/keys = { | ||||
| "times": PackedFloat32Array(0), | ||||
| "transitions": PackedFloat32Array(1), | ||||
| "update": 0, | ||||
| "values": [Vector3(0, 0.0417832, 0)] | ||||
| } | ||||
|  | ||||
| [sub_resource type="Animation" id="Animation_2hs0m"] | ||||
| resource_name = "move" | ||||
| loop_mode = 1 | ||||
| @@ -187,6 +188,7 @@ skeleton = NodePath("../..") | ||||
| [node name="PlayerCamera" type="Camera3D" parent="Head"] | ||||
|  | ||||
| [node name="PlayerDebug" type="CanvasLayer" parent="Head/PlayerCamera"] | ||||
| visible = false | ||||
| script = ExtResource("2_onrkg") | ||||
|  | ||||
| [node name="PlayerDebugText" type="RichTextLabel" parent="Head/PlayerCamera/PlayerDebug"] | ||||
| @@ -210,6 +212,25 @@ draw_pass_1 = SubResource("PlaneMesh_n7ghd") | ||||
| transform = Transform3D(0.998255, -0.041771, 0.0417346, 0.041771, -4.37114e-08, -0.999127, 0.0417346, 0.999127, 0.00174477, 0.000758827, 0.0641694, -0.246936) | ||||
| target_position = Vector3(0, -50, 0) | ||||
|  | ||||
| [node name="OverlayFPS" type="CanvasLayer" parent="Head/PlayerCamera"] | ||||
| script = ExtResource("5_2hs0m") | ||||
|  | ||||
| [node name="RichTextLabel" type="RichTextLabel" parent="Head/PlayerCamera/OverlayFPS"] | ||||
| anchors_preset = 1 | ||||
| anchor_left = 1.0 | ||||
| anchor_right = 1.0 | ||||
| offset_left = -1153.0 | ||||
| offset_bottom = 40.0 | ||||
| grow_horizontal = 0 | ||||
| size_flags_horizontal = 8 | ||||
| size_flags_vertical = 0 | ||||
| text = "FPS: 10.0" | ||||
| fit_content = true | ||||
| horizontal_alignment = 2 | ||||
|  | ||||
| [node name="Timer" type="Timer" parent="Head/PlayerCamera/OverlayFPS"] | ||||
| wait_time = 0.5 | ||||
|  | ||||
| [node name="PlayerStats" type="Node" parent="."] | ||||
| script = ExtResource("3_i3pqv") | ||||
|  | ||||
| @@ -219,3 +240,6 @@ libraries = { | ||||
| } | ||||
| autoplay = "move" | ||||
| playback_default_blend_time = 0.05 | ||||
|  | ||||
| [connection signal="visibility_changed" from="Head/PlayerCamera/OverlayFPS" to="Head/PlayerCamera/OverlayFPS" method="_on_visibility_changed"] | ||||
| [connection signal="timeout" from="Head/PlayerCamera/OverlayFPS/Timer" to="Head/PlayerCamera/OverlayFPS" method="_on_timer_timeout"] | ||||
|   | ||||
| @@ -57,3 +57,8 @@ shoot={ | ||||
| "events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(204, 17),"global_position":Vector2(213, 65),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null) | ||||
| ] | ||||
| } | ||||
| overlay_fps={ | ||||
| "deadzone": 0.2, | ||||
| "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194333,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) | ||||
| ] | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user