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

2
.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# Godot 4+ specific ignores
.godot/

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

24
LICENSE Normal file
View File

@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <https://unlicense.org>

20
README.md Normal file
View File

@ -0,0 +1,20 @@
![](https://github.com/sammburr/Basic-FPS-Player-GODOT-4.0/blob/4929a04b2791b13184eea82ead9caaf57894be48/addons/Basic%20FPS%20Player/Assets/Basic%20FPS%20Player.png)
# Basic-FPS-Player-GODOT-4.0
(`GDScript`) Godot 4.0 *very* basic FPS player controller with mouse and keyboard input for a kick start in your fps project.
Current version **V1.2**
- Basic walk + jump
- Head bob
- Mouse acceleration + smoothing
- Easy action rebinding
## Installation
See: [Youtube Installation Video](https://www.youtube.com/watch?v=-yS7S-bYY3s)
## Usage
All relevant settings are exported to godot to tweak within the editor.
The character will only listen to mouse input when the mouse is captured;
(`Input.mouse_mode = Input.MOUSE_MODE_CAPTURED`).
Enjoy! :)

10
game.gd Normal file
View File

@ -0,0 +1,10 @@
extends Node3D
signal pause_button
func _ready():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
func _input(event):
if event.is_action_pressed("quit"):
emit_signal("pause_button")

74
game.tscn Normal file

File diff suppressed because one or more lines are too long

1
icon.svg Normal file
View File

@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>

After

Width:  |  Height:  |  Size: 950 B

37
icon.svg.import Normal file
View File

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bduep6u8y6ou7"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

87
project.godot Normal file
View File

@ -0,0 +1,87 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="HorrorGame"
run/main_scene="res://game.tscn"
config/features=PackedStringArray("4.2", "Forward Plus")
config/icon="res://icon.svg"
[display]
window/size/viewport_width=1920
window/size/viewport_height=1080
[input]
vape={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":10,"pressure":0.0,"pressed":true,"script":null)
, 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":70,"key_label":0,"unicode":102,"echo":false,"script":null)
]
}
look_left={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null)
]
}
look_right={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null)
]
}
look_up={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null)
]
}
look_down={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
]
}
move_forward={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
, 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":87,"key_label":0,"unicode":119,"echo":false,"script":null)
]
}
move_back={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
, 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":83,"key_label":0,"unicode":114,"echo":false,"script":null)
]
}
move_right={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
, 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":83,"physical_keycode":0,"key_label":0,"unicode":115,"echo":false,"script":null)
]
}
move_left={
"deadzone": 0.5,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
, 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":65,"physical_keycode":0,"key_label":0,"unicode":97,"echo":false,"script":null)
]
}
sprint={
"deadzone": 0.5,
"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":4194325,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":9,"pressure":0.0,"pressed":true,"script":null)
]
}
quit={
"deadzone": 0.5,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":true,"script":null)
, 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":4194305,"key_label":0,"unicode":0,"echo":false,"script":null)
]
}