updated settings and menu more
This commit is contained in:
parent
2cedc10bb5
commit
7b382dcbe1
6 changed files with 57 additions and 14 deletions
|
@ -10,9 +10,11 @@ var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
|
|||
@onready var neck := $Neck
|
||||
@onready var camera := $Neck/Camera3D
|
||||
|
||||
var openmenu = false
|
||||
var globalscene
|
||||
|
||||
func _ready():
|
||||
Global.playingGame = true
|
||||
|
||||
func _unhandled_input(event):
|
||||
if event is InputEventMouseButton:
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
|
@ -24,16 +26,16 @@ func _unhandled_input(event):
|
|||
neck.rotate_y(-event.relative.x * mousesense)
|
||||
camera.rotate_x(-event.relative.y * mousesense)
|
||||
camera.rotation.x = clamp(camera.rotation.x, deg_to_rad(-35), deg_to_rad(60))
|
||||
if openmenu == false:
|
||||
if Global.menuOpen == false:
|
||||
if Input.is_action_just_pressed("menu"):
|
||||
openmenu = true
|
||||
Global.menuOpen = true
|
||||
var scene_trs = load("res://scenes/mainmenu.tscn")
|
||||
var scene = scene_trs.instantiate()
|
||||
globalscene = scene
|
||||
add_child(scene)
|
||||
elif openmenu == true:
|
||||
elif Global.menuOpen == true:
|
||||
if Input.is_action_just_pressed("menu"):
|
||||
openmenu = false
|
||||
Global.menuOpen = false
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
if globalscene:
|
||||
globalscene.queue_free()
|
||||
|
|
|
@ -13,6 +13,7 @@ config_version=5
|
|||
config/name="Project Teddy"
|
||||
run/main_scene="res://scenes/mainmenu.tscn"
|
||||
config/features=PackedStringArray("4.0", "Forward Plus")
|
||||
boot_splash/show_image=false
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://dy5lqto7557fg"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dy5lqto7557fg"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/settings.gd" id="1_gpx88"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_j46gp"]
|
||||
bg_color = Color(0.2, 0.2, 0.2, 1)
|
||||
|
||||
[node name="settings" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
@ -11,23 +14,47 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
script = ExtResource("1_gpx88")
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -110.0
|
||||
offset_top = -156.0
|
||||
offset_right = 140.0
|
||||
offset_bottom = 134.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_j46gp")
|
||||
|
||||
[node name="h_slider" type="HSlider" parent="."]
|
||||
layout_mode = 2
|
||||
offset_left = 498.0
|
||||
offset_top = 249.0
|
||||
offset_top = 238.0
|
||||
offset_right = 682.0
|
||||
offset_bottom = 265.0
|
||||
offset_bottom = 254.0
|
||||
max_value = 0.02
|
||||
step = 0.001
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
offset_left = 497.0
|
||||
offset_top = 224.0
|
||||
offset_top = 213.0
|
||||
offset_right = 685.0
|
||||
offset_bottom = 250.0
|
||||
offset_bottom = 239.0
|
||||
size_flags_vertical = 0
|
||||
text = "Adjust Mouse sensitivity"
|
||||
|
||||
[node name="Button" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 470.0
|
||||
offset_top = 173.0
|
||||
offset_right = 501.0
|
||||
offset_bottom = 204.0
|
||||
text = "X"
|
||||
|
||||
[connection signal="ready" from="h_slider" to="." method="_on_h_slider_ready"]
|
||||
[connection signal="value_changed" from="h_slider" to="." method="_on_h_slider_value_changed"]
|
||||
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
extends Node
|
||||
|
||||
var mouseSensitivity = 0.01 # Unless otherwise changed by user in settings
|
||||
var playingGame = false
|
||||
var menuOpen = false
|
||||
|
|
|
@ -1,16 +1,23 @@
|
|||
extends Control
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
|
||||
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
if Global.playingGame == true:
|
||||
$Button.text = "RESUME"
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
pass
|
||||
|
||||
func _on_button_pressed():
|
||||
get_tree().change_scene_to_file("res://scenes/playground.tscn")
|
||||
if Global.playingGame == false:
|
||||
get_tree().change_scene_to_file("res://scenes/playground.tscn")
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
elif Global.playingGame == true:
|
||||
self.queue_free()
|
||||
Global.menuOpen = false
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
|
||||
|
||||
func _on_button_2_pressed():
|
||||
var scene_trs =load("res://scenes/settings.tscn")
|
||||
|
|
|
@ -15,3 +15,7 @@ func _process(delta):
|
|||
|
||||
func _on_h_slider_value_changed(value):
|
||||
Global.mouseSensitivity = value
|
||||
|
||||
|
||||
func _on_button_pressed():
|
||||
self.queue_free()
|
||||
|
|
Loading…
Reference in a new issue