Player and Pause Menu have been setup

This commit is contained in:
2024-04-04 15:09:20 -05:00
commit 643be614c5
28 changed files with 901 additions and 0 deletions

17
Assets/Tileset.tres Normal file
View File

@ -0,0 +1,17 @@
[gd_resource type="MeshLibrary" load_steps=4 format=3 uid="uid://cxnlt46btvw4b"]
[ext_resource type="Texture2D" uid="uid://dlggbkhxijuy1" path="res://Assets/textures/Mountain brown rock seamless texture 2048x2048.jpg" id="1_5x3ju"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_45hxk"]
albedo_texture = ExtResource("1_5x3ju")
[sub_resource type="BoxMesh" id="BoxMesh_djq7j"]
material = SubResource("StandardMaterial3D_45hxk")
[resource]
item/0/name = "Rock"
item/0/mesh = SubResource("BoxMesh_djq7j")
item/0/mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/0/shapes = []
item/0/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/0/navigation_layers = 1

View File

@ -0,0 +1,28 @@
extends Control
func _on_game_pause_button():
if $Settings.visible:
$Settings.hide()
$"Pause Menu".show()
elif $"Pause Menu".visible:
$"Pause Menu".hide()
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
else:
$"Pause Menu".show()
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
func _on_quit_pressed():
get_tree().quit()
func _on_resume_pressed():
hide()
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
func _on_settings_pressed():
$"Pause Menu".hide()
$"Settings".show()

View File

@ -0,0 +1,137 @@
[gd_scene load_steps=2 format=3 uid="uid://bwo6gvmi3jcqt"]
[ext_resource type="Script" path="res://Assets/components/Pause Screen.gd" id="1_tqif2"]
[node name="Menus" 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_tqif2")
[node name="Pause Menu" type="Control" parent="."]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Pause Label" type="RichTextLabel" parent="Pause Menu"]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -35.0
offset_right = 35.0
offset_bottom = 28.0
grow_horizontal = 2
text = "Paused"
[node name="Menu" type="VBoxContainer" parent="Pause Menu"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -35.0
offset_top = -50.5
offset_right = 35.0
offset_bottom = 50.5
grow_horizontal = 2
grow_vertical = 2
[node name="Resume" type="Button" parent="Pause Menu/Menu"]
layout_mode = 2
text = "Resume"
[node name="Settings" type="Button" parent="Pause Menu/Menu"]
layout_mode = 2
text = "Settings"
[node name="Quit" type="Button" parent="Pause Menu/Menu"]
layout_mode = 2
text = "Quit
"
[node name="Settings" type="Control" parent="."]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -23.0
offset_top = 42.0
offset_right = -23.0
offset_bottom = 42.0
grow_horizontal = 2
grow_vertical = 2
[node name="Label" type="Label" parent="Settings"]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -20.0
offset_right = 20.0
offset_bottom = 23.0
grow_horizontal = 2
text = "Settings"
[node name="VBoxContainer" type="VBoxContainer" parent="Settings"]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -223.0
offset_top = -430.5
offset_right = 223.0
offset_bottom = 430.5
grow_horizontal = 2
grow_vertical = 2
[node name="ColorRect" type="ColorRect" parent="Settings/VBoxContainer"]
custom_minimum_size = Vector2(0, 35)
layout_mode = 2
color = Color(0.184314, 0.184314, 0.184314, 1)
[node name="HSplitContainer" type="HSplitContainer" parent="Settings/VBoxContainer/ColorRect"]
layout_mode = 2
offset_top = 4.0
offset_right = 446.0
offset_bottom = 27.0
[node name="Label" type="Label" parent="Settings/VBoxContainer/ColorRect/HSplitContainer"]
layout_mode = 2
text = "Mouse Sensitity"
[node name="HSlider" type="HSlider" parent="Settings/VBoxContainer/ColorRect/HSplitContainer"]
layout_mode = 2
[node name="ColorRect2" type="ColorRect" parent="Settings/VBoxContainer"]
custom_minimum_size = Vector2(0, 35)
layout_mode = 2
color = Color(0.184314, 0.184314, 0.184314, 1)
[node name="HSplitContainer" type="HSplitContainer" parent="Settings/VBoxContainer/ColorRect2"]
layout_mode = 2
offset_top = 4.0
offset_right = 446.0
offset_bottom = 27.0
[node name="Label" type="Label" parent="Settings/VBoxContainer/ColorRect2/HSplitContainer"]
layout_mode = 2
text = "Joystick Sensativity"
[node name="HSlider" type="HSlider" parent="Settings/VBoxContainer/ColorRect2/HSplitContainer"]
layout_mode = 2
[connection signal="pressed" from="Pause Menu/Menu/Resume" to="." method="_on_resume_pressed"]
[connection signal="pressed" from="Pause Menu/Menu/Settings" to="." method="_on_settings_pressed"]
[connection signal="pressed" from="Pause Menu/Menu/Quit" to="." method="_on_quit_pressed"]

View File

@ -0,0 +1,22 @@
[gd_scene load_steps=5 format=3 uid="uid://er8qeqe4d466"]
[ext_resource type="Texture2D" uid="uid://db6enrh77cnbb" path="res://Assets/textures/wall_a.jpg" id="1_52lln"]
[sub_resource type="BoxShape3D" id="BoxShape3D_igcda"]
size = Vector3(5, 3.5, 0.2)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jo56m"]
albedo_texture = ExtResource("1_52lln")
[sub_resource type="BoxMesh" id="BoxMesh_ivu18"]
material = SubResource("StandardMaterial3D_jo56m")
size = Vector3(5, 3.5, 0.2)
[node name="StaticBody3D" type="StaticBody3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("BoxShape3D_igcda")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("BoxMesh_ivu18")
skeleton = NodePath("../CollisionShape3D")

View File

@ -0,0 +1,47 @@
[gd_scene load_steps=5 format=3 uid="uid://bcjijcf8br8t4"]
[ext_resource type="Script" path="res://Assets/scripts/player.gd" id="1_b2ij4"]
[ext_resource type="Script" path="res://Assets/scripts/Head.gd" id="2_is0vo"]
[ext_resource type="Script" path="res://Assets/components/vapelight.gd" id="2_ndvgb"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_lm3xc"]
[node name="Player" type="CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.999344, 0)
script = ExtResource("1_b2ij4")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("CapsuleShape3D_lm3xc")
[node name="Node3D" type="Node3D" parent="."]
script = ExtResource("2_is0vo")
[node name="Camera" type="Camera3D" parent="Node3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.576, 0)
current = true
[node name="VapeLight" type="SpotLight3D" parent="Node3D"]
transform = Transform3D(1, 0, 0, 0, 0.934826, 0.355107, 0, -0.355107, 0.934826, 0.012711, 0.254978, 0.0294437)
light_color = Color(0.247059, 0.407843, 0.603922, 1)
spot_range = 5.368
spot_attenuation = 0.847127
spot_angle = 62.91
spot_angle_attenuation = 1.38495
script = ExtResource("2_ndvgb")
[node name="Severe Coughing Timer" type="Timer" parent="."]
wait_time = 10.0
[node name="Coughing Timer" type="Timer" parent="."]
wait_time = 3.0
[node name="Coughing Recovery" type="Timer" parent="."]
wait_time = 5.0
[node name="Severe Coughing Recovery" type="Timer" parent="."]
wait_time = 15.0
[connection signal="timeout" from="Severe Coughing Timer" to="." method="_on_severe_coughing_timer_timeout"]
[connection signal="timeout" from="Coughing Timer" to="." method="_on_coughing_timer_timeout"]
[connection signal="timeout" from="Coughing Recovery" to="." method="_on_coughing_recovery_timeout"]
[connection signal="timeout" from="Severe Coughing Recovery" to="." method="_on_severe_coughing_recovery_timeout"]

View File

@ -0,0 +1,23 @@
[gd_scene load_steps=5 format=3 uid="uid://dmbqijgut3s51"]
[ext_resource type="Texture2D" uid="uid://dlggbkhxijuy1" path="res://Assets/textures/Mountain brown rock seamless texture 2048x2048.jpg" id="1_rd1yx"]
[sub_resource type="BoxShape3D" id="BoxShape3D_2xgye"]
size = Vector3(10, 1, 10)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jb2bo"]
albedo_texture = ExtResource("1_rd1yx")
[sub_resource type="BoxMesh" id="BoxMesh_eip3x"]
material = SubResource("StandardMaterial3D_jb2bo")
size = Vector3(10, 1, 10)
[node name="Rock Floor" type="StaticBody3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.75, 0, 0)
shape = SubResource("BoxShape3D_2xgye")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.831642, 0, 0)
mesh = SubResource("BoxMesh_eip3x")

View File

@ -0,0 +1,23 @@
extends SpotLight3D
var Power = 0.0
var MaxPow = 6
var is_vaping = false
func _ready():
light_energy = 0
func _process(delta):
if is_vaping:
if light_energy < MaxPow:
light_energy += 1 * delta
else:
if light_energy > 0:
light_energy -= .50
func on():
is_vaping = true
func off():
is_vaping = false

View File

@ -0,0 +1,23 @@
[gd_scene load_steps=5 format=3 uid="uid://bkbhm2x07o5vd"]
[ext_resource type="Texture2D" uid="uid://dlggbkhxijuy1" path="res://Assets/textures/Mountain brown rock seamless texture 2048x2048.jpg" id="1_gkfw0"]
[sub_resource type="BoxShape3D" id="BoxShape3D_b1bm2"]
size = Vector3(10, 10, 1)
[sub_resource type="BoxMesh" id="BoxMesh_nsuje"]
size = Vector3(10, 10, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_yyl1p"]
albedo_texture = ExtResource("1_gkfw0")
emission = Color(0.768627, 0.388235, 0.92549, 1)
[node name="StaticBody3D" type="StaticBody3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0809937, 0, 0)
shape = SubResource("BoxShape3D_b1bm2")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("BoxMesh_nsuje")
surface_material_override/0 = SubResource("StandardMaterial3D_yyl1p")

11
Assets/scripts/Head.gd Normal file
View File

@ -0,0 +1,11 @@
extends Node3D
@export var vertical_joystick_sensitity : float = 2
func _process(delta):
var look_velocity = Input.get_vector("look_left", "look_right", "look_up", "look_down")
rotate_x(-look_velocity.y * vertical_joystick_sensitity * delta)
func _unhandled_input(event):
if event is InputEventMouseMotion:
rotate_x(-event.relative.y * 0.02 )

140
Assets/scripts/player.gd Normal file
View File

@ -0,0 +1,140 @@
extends CharacterBody3D
#Condition Effect
enum CONDITION {NORMAL, SPRINTING, VAPING, COUGHING, SEVERE_COUGHING}
@export var current_condition = CONDITION.NORMAL
func set_condition(con):
current_condition = con
print("Setting Condition to ", con)
var will_cough = false
var timealive = 0
var vapes_per_min = 0
var current_speed
const SPEED_NORMAL = 5.0
const SPEED_SPRINTING = 8.0
const SPEED_VAPING = 4.5
const SPEED_SLOWED = 3.0
const SPEED_IMMOBILE = 0.0
const JUMP_VELOCITY = 4.5
#Looking Variables
var mouse_sensitivity = 0.02
var joystick_sensitity = 2
var prev_mouse_location = Vector2()
# Get the gravity from the project settings to be synced with RigidBody nodes.
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
func _physics_process(delta):
match current_condition:
CONDITION.NORMAL:
current_speed = SPEED_NORMAL
CONDITION.SPRINTING:
current_speed = SPEED_SPRINTING
CONDITION.VAPING:
current_speed = SPEED_VAPING
CONDITION.COUGHING:
current_speed = SPEED_SLOWED
CONDITION.SEVERE_COUGHING:
current_speed = SPEED_IMMOBILE
# Add the gravity.
if not is_on_floor():
velocity.y -= gravity * delta
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor() and current_condition == CONDITION.NORMAL or current_condition == CONDITION.SPRINTING:
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_back")
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * current_speed
velocity.z = direction.z * current_speed
else:
velocity.x = move_toward(velocity.x, 0, current_speed)
velocity.z = move_toward(velocity.z, 0, current_speed)
move_and_slide()
var look_velocity = Input.get_vector("look_left", "look_right", "look_up", "look_down")
rotate_y(-look_velocity.x * joystick_sensitity * delta)
#Look mouse controls left and right
func _unhandled_input(event):
if event is InputEventMouseMotion:
rotate_y(-event.relative.x * mouse_sensitivity)
func _process(delta):
#Calculations for seeing if you vaped too many times within a short span
timealive += delta
if int(timealive) % 60 == 0:
vapes_per_min = 0
if vapes_per_min == randi_range(10,20):
will_cough = true
vapes_per_min = 0
func _input(event):
if event.is_action_pressed("vape"):
if current_condition == CONDITION.NORMAL:
vapes_per_min += 1
set_condition(CONDITION.VAPING)
$"Coughing Timer".start()
$"Severe Coughing Timer".start()
$Node3D/VapeLight.on()
if event.is_action_released("vape"):
$Node3D/VapeLight.off()
if current_condition == CONDITION.VAPING:
if will_cough and current_condition != CONDITION.SEVERE_COUGHING:
set_condition(CONDITION.COUGHING)
# Play Coughing Sound
$"Coughing Recovery".start()
$"Severe Coughing Timer".stop()
else:
set_condition(CONDITION.NORMAL)
$"Coughing Timer".stop()
$"Severe Coughing Timer".stop()
if event.is_action_pressed("sprint"):
if current_condition == CONDITION.NORMAL:
set_condition(CONDITION.SPRINTING)
if event.is_action_released("sprint"):
if current_condition == CONDITION.SPRINTING:
set_condition(CONDITION.NORMAL)
func recover():
will_cough = false
match current_condition:
CONDITION.COUGHING:
set_condition(CONDITION.NORMAL)
CONDITION.SEVERE_COUGHING:
set_condition(CONDITION.NORMAL)
#Timers
func _on_coughing_timer_timeout():
will_cough = true
func _on_severe_coughing_timer_timeout():
if current_condition == CONDITION.VAPING:
set_condition(CONDITION.SEVERE_COUGHING)
$Node3D/VapeLight.off()
#Play Coughing Sound
$"Severe Coughing Recovery".start()
func _on_coughing_recovery_timeout():
recover()
func _on_severe_coughing_recovery_timeout():
recover()

BIN
Assets/textures/Grass.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d2787ecuyoap2"
path="res://.godot/imported/Grass.jpg-f426c1783d50435e28ef0b8dc74d62e6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/textures/Grass.jpg"
dest_files=["res://.godot/imported/Grass.jpg-f426c1783d50435e28ef0b8dc74d62e6.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dlggbkhxijuy1"
path.etc2="res://.godot/imported/Mountain brown rock seamless texture 2048x2048.jpg-28ae420fb6608101dbb93c6653a39409.etc2.ctex"
metadata={
"imported_formats": ["etc2_astc"],
"vram_texture": true
}
[deps]
source_file="res://Assets/textures/Mountain brown rock seamless texture 2048x2048.jpg"
dest_files=["res://.godot/imported/Mountain brown rock seamless texture 2048x2048.jpg-28ae420fb6608101dbb93c6653a39409.etc2.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

BIN
Assets/textures/Rock.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b4wrapx8kjia3"
path.etc2="res://.godot/imported/Rock.jpg-b7553527d3ced771bdf2cee26ec284ce.etc2.ctex"
metadata={
"imported_formats": ["etc2_astc"],
"vram_texture": true
}
[deps]
source_file="res://Assets/textures/Rock.jpg"
dest_files=["res://.godot/imported/Rock.jpg-b7553527d3ced771bdf2cee26ec284ce.etc2.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://6tcowk5wlp76"
path="res://.godot/imported/gravel_path.jpg-a256e38373277290ddca2eb94f31185d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/textures/gravel_path.jpg"
dest_files=["res://.godot/imported/gravel_path.jpg-a256e38373277290ddca2eb94f31185d.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

BIN
Assets/textures/wall_a.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://db6enrh77cnbb"
path.etc2="res://.godot/imported/wall_a.jpg-a965d12957ecfb4413d8c7de304c494d.etc2.ctex"
metadata={
"imported_formats": ["etc2_astc"],
"vram_texture": true
}
[deps]
source_file="res://Assets/textures/wall_a.jpg"
dest_files=["res://.godot/imported/wall_a.jpg-a965d12957ecfb4413d8c7de304c494d.etc2.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0