Add FPS
This commit is contained in:
parent
e340b0d325
commit
693d9d12ae
8 changed files with 324 additions and 0 deletions
121
export_presets.cfg
Normal file
121
export_presets.cfg
Normal file
|
|
@ -0,0 +1,121 @@
|
||||||
|
[preset.0]
|
||||||
|
|
||||||
|
name="Windows Desktop"
|
||||||
|
platform="Windows Desktop"
|
||||||
|
runnable=true
|
||||||
|
dedicated_server=false
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path="exportboi/FeedTheFish_smoll.exe"
|
||||||
|
patches=PackedStringArray()
|
||||||
|
patch_delta_encoding=false
|
||||||
|
patch_delta_compression_level_zstd=19
|
||||||
|
patch_delta_min_reduction=0.1
|
||||||
|
patch_delta_include_filters="*"
|
||||||
|
patch_delta_exclude_filters=""
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
seed=0
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
script_export_mode=2
|
||||||
|
|
||||||
|
[preset.0.options]
|
||||||
|
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
debug/export_console_wrapper=1
|
||||||
|
binary_format/embed_pck=true
|
||||||
|
texture_format/s3tc_bptc=true
|
||||||
|
texture_format/etc2_astc=false
|
||||||
|
shader_baker/enabled=false
|
||||||
|
binary_format/architecture="x86_64"
|
||||||
|
codesign/enable=false
|
||||||
|
codesign/timestamp=true
|
||||||
|
codesign/timestamp_server_url=""
|
||||||
|
codesign/digest_algorithm=1
|
||||||
|
codesign/description=""
|
||||||
|
codesign/custom_options=PackedStringArray()
|
||||||
|
application/modify_resources=true
|
||||||
|
application/icon=""
|
||||||
|
application/console_wrapper_icon=""
|
||||||
|
application/icon_interpolation=4
|
||||||
|
application/file_version=""
|
||||||
|
application/product_version=""
|
||||||
|
application/company_name="Swedish Space Communist Corporation"
|
||||||
|
application/product_name="FeedTheFish"
|
||||||
|
application/file_description=""
|
||||||
|
application/copyright=""
|
||||||
|
application/trademarks=""
|
||||||
|
application/export_angle=0
|
||||||
|
application/export_d3d12=0
|
||||||
|
application/d3d12_agility_sdk_multiarch=true
|
||||||
|
ssh_remote_deploy/enabled=false
|
||||||
|
ssh_remote_deploy/host="user@host_ip"
|
||||||
|
ssh_remote_deploy/port="22"
|
||||||
|
ssh_remote_deploy/extra_args_ssh=""
|
||||||
|
ssh_remote_deploy/extra_args_scp=""
|
||||||
|
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
|
||||||
|
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
|
||||||
|
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
|
||||||
|
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
|
||||||
|
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
|
||||||
|
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
|
||||||
|
Start-ScheduledTask -TaskName godot_remote_debug
|
||||||
|
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
|
||||||
|
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
|
||||||
|
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
||||||
|
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
||||||
|
Remove-Item -Recurse -Force '{temp_dir}'"
|
||||||
|
|
||||||
|
[preset.1]
|
||||||
|
|
||||||
|
name="Web"
|
||||||
|
platform="Web"
|
||||||
|
runnable=true
|
||||||
|
dedicated_server=false
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path="exportboi/hello/FeedTheFish_smoll.html"
|
||||||
|
patches=PackedStringArray()
|
||||||
|
patch_delta_encoding=false
|
||||||
|
patch_delta_compression_level_zstd=19
|
||||||
|
patch_delta_min_reduction=0.1
|
||||||
|
patch_delta_include_filters="*"
|
||||||
|
patch_delta_exclude_filters=""
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
seed=0
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
script_export_mode=2
|
||||||
|
|
||||||
|
[preset.1.options]
|
||||||
|
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
variant/extensions_support=false
|
||||||
|
variant/thread_support=false
|
||||||
|
vram_texture_compression/for_desktop=true
|
||||||
|
vram_texture_compression/for_mobile=false
|
||||||
|
html/export_icon=true
|
||||||
|
html/custom_html_shell=""
|
||||||
|
html/head_include=""
|
||||||
|
html/canvas_resize_policy=2
|
||||||
|
html/focus_canvas_on_start=true
|
||||||
|
html/experimental_virtual_keyboard=false
|
||||||
|
progressive_web_app/enabled=false
|
||||||
|
progressive_web_app/ensure_cross_origin_isolation_headers=true
|
||||||
|
progressive_web_app/offline_page=""
|
||||||
|
progressive_web_app/display=1
|
||||||
|
progressive_web_app/orientation=0
|
||||||
|
progressive_web_app/icon_144x144=""
|
||||||
|
progressive_web_app/icon_180x180=""
|
||||||
|
progressive_web_app/icon_512x512=""
|
||||||
|
progressive_web_app/background_color=Color(0, 0, 0, 1)
|
||||||
|
threads/emscripten_pool_size=8
|
||||||
|
threads/godot_pool_size=4
|
||||||
33
fps_controller.tscn
Normal file
33
fps_controller.tscn
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
[gd_scene format=3 uid="uid://biwwx41ucnqdu"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dpbe5stprhgay" path="res://scripts/fps_controller.gd" id="1_ja5wc"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_j0767"]
|
||||||
|
|
||||||
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_j0767"]
|
||||||
|
albedo_color = Color(1, 0.35686275, 1, 1)
|
||||||
|
metallic = 1.0
|
||||||
|
metallic_specular = 0.96
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleMesh" id="CapsuleMesh_ja5wc"]
|
||||||
|
material = SubResource("StandardMaterial3D_j0767")
|
||||||
|
|
||||||
|
[node name="CharacterBody3D" type="CharacterBody3D" unique_id=1574026121 node_paths=PackedStringArray("CAMERA_CONTROLLER")]
|
||||||
|
script = ExtResource("1_ja5wc")
|
||||||
|
CAMERA_CONTROLLER = NodePath("CameraController/Camera3D")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=937427845]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||||
|
shape = SubResource("CapsuleShape3D_j0767")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="CollisionShape3D" unique_id=1623987747]
|
||||||
|
mesh = SubResource("CapsuleMesh_ja5wc")
|
||||||
|
|
||||||
|
[node name="CameraController" type="Node3D" parent="." unique_id=1589107637]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0)
|
||||||
|
|
||||||
|
[node name="Camera3D" type="Camera3D" parent="CameraController" unique_id=1226600021]
|
||||||
|
|
||||||
|
[node name="ReflectionProbe" type="ReflectionProbe" parent="CameraController/Camera3D" unique_id=1194714730]
|
||||||
|
update_mode = 1
|
||||||
|
size = Vector3(50, 50, 50)
|
||||||
|
|
@ -8,13 +8,54 @@
|
||||||
|
|
||||||
config_version=5
|
config_version=5
|
||||||
|
|
||||||
|
[accessibility]
|
||||||
|
|
||||||
|
general/accessibility_support=2
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="FeedTheFish"
|
config/name="FeedTheFish"
|
||||||
run/main_scene="uid://c2sbkop0dvony"
|
run/main_scene="uid://c2sbkop0dvony"
|
||||||
config/features=PackedStringArray("4.6", "GL Compatibility")
|
config/features=PackedStringArray("4.6", "GL Compatibility")
|
||||||
|
boot_splash/bg_color=Color(0.04832451, 0.08543614, 1.2032688e-08, 1)
|
||||||
|
boot_splash/show_image=false
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/size/viewport_width=2560
|
||||||
|
window/size/viewport_height=1440
|
||||||
|
window/size/mode=3
|
||||||
|
window/vsync/vsync_mode=0
|
||||||
|
|
||||||
|
[input]
|
||||||
|
|
||||||
|
Forward={
|
||||||
|
"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":87,"key_label":0,"unicode":119,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Back={
|
||||||
|
"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":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Left={
|
||||||
|
"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":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Right={
|
||||||
|
"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":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
Quit={
|
||||||
|
"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":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
3d/physics_engine="Jolt Physics"
|
3d/physics_engine="Jolt Physics"
|
||||||
|
|
@ -24,3 +65,4 @@ config/icon="res://icon.svg"
|
||||||
rendering_device/driver.windows="d3d12"
|
rendering_device/driver.windows="d3d12"
|
||||||
renderer/rendering_method="gl_compatibility"
|
renderer/rendering_method="gl_compatibility"
|
||||||
renderer/rendering_method.mobile="gl_compatibility"
|
renderer/rendering_method.mobile="gl_compatibility"
|
||||||
|
anti_aliasing/quality/msaa_3d=3
|
||||||
|
|
|
||||||
0
scenes/Player.gd
Normal file
0
scenes/Player.gd
Normal file
1
scenes/Player.gd.uid
Normal file
1
scenes/Player.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://h607n3vn78wt
|
||||||
|
|
@ -1,3 +1,56 @@
|
||||||
[gd_scene format=3 uid="uid://c2sbkop0dvony"]
|
[gd_scene format=3 uid="uid://c2sbkop0dvony"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://biwwx41ucnqdu" path="res://fps_controller.tscn" id="1_0wfyh"]
|
||||||
|
|
||||||
|
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_sgp6g"]
|
||||||
|
sky_top_color = Color(0.38634497, 0.45709372, 0.55142766, 1)
|
||||||
|
sky_horizon_color = Color(0.56396353, 0.6080805, 0.6193286, 1)
|
||||||
|
ground_bottom_color = Color(0.024895558, 0.13061434, 0.08127297, 1)
|
||||||
|
ground_horizon_color = Color(0.56396353, 0.6080805, 0.6193286, 1)
|
||||||
|
energy_multiplier = 1.25
|
||||||
|
|
||||||
|
[sub_resource type="Sky" id="Sky_o5qli"]
|
||||||
|
sky_material = SubResource("ProceduralSkyMaterial_sgp6g")
|
||||||
|
|
||||||
|
[sub_resource type="Environment" id="Environment_0wfyh"]
|
||||||
|
background_mode = 2
|
||||||
|
sky = SubResource("Sky_o5qli")
|
||||||
|
tonemap_mode = 2
|
||||||
|
sdfgi_enabled = true
|
||||||
|
|
||||||
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_o5qli"]
|
||||||
|
albedo_color = Color(0.101960786, 0.48235294, 0.039215688, 1)
|
||||||
|
metallic = 0.8
|
||||||
|
roughness = 0.4
|
||||||
|
emission_energy_multiplier = 5.0
|
||||||
|
clearcoat_roughness = 0.0
|
||||||
|
grow_amount = 0.547
|
||||||
|
|
||||||
|
[sub_resource type="PlaneMesh" id="PlaneMesh_sgp6g"]
|
||||||
|
material = SubResource("StandardMaterial3D_o5qli")
|
||||||
|
size = Vector2(20, 20)
|
||||||
|
|
||||||
|
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_sgp6g"]
|
||||||
|
data = PackedVector3Array(10, 0, 10, -10, 0, 10, 10, 0, -10, -10, 0, 10, -10, 0, -10, 10, 0, -10)
|
||||||
|
|
||||||
[node name="Node3D" type="Node3D" unique_id=1636936930]
|
[node name="Node3D" type="Node3D" unique_id=1636936930]
|
||||||
|
|
||||||
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=396505538]
|
||||||
|
transform = Transform3D(-0.8660254, -0.4806309, 0.13781871, 0, 0.2756374, 0.9612617, -0.50000006, 0.83247703, -0.23870897, 0, 0, 0)
|
||||||
|
light_color = Color(1, 1, 0.83137256, 1)
|
||||||
|
shadow_enabled = true
|
||||||
|
|
||||||
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1423631291]
|
||||||
|
environment = SubResource("Environment_0wfyh")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=657626596]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0037879944, 0.006898403, -0.0006710291)
|
||||||
|
mesh = SubResource("PlaneMesh_sgp6g")
|
||||||
|
|
||||||
|
[node name="StaticBody3D" type="StaticBody3D" parent="MeshInstance3D" unique_id=348213149]
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/StaticBody3D" unique_id=1236898589]
|
||||||
|
shape = SubResource("ConcavePolygonShape3D_sgp6g")
|
||||||
|
|
||||||
|
[node name="CharacterBody3D" parent="." unique_id=1574026121 instance=ExtResource("1_0wfyh")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00793457, 0.006890297, -0.003504753)
|
||||||
|
|
|
||||||
73
scripts/fps_controller.gd
Normal file
73
scripts/fps_controller.gd
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
extends CharacterBody3D
|
||||||
|
|
||||||
|
|
||||||
|
@export var SPEED: float = 5.0
|
||||||
|
@export var JUMP_VELOCITY: float = 4.5
|
||||||
|
|
||||||
|
var _mouse_input: bool = false
|
||||||
|
var _mouse_rotation: Vector3
|
||||||
|
var _rotation_input: float
|
||||||
|
var _tilt_input: float
|
||||||
|
var _player_rotation : Vector3
|
||||||
|
var _camera_rotation: Vector3
|
||||||
|
|
||||||
|
@export var MOUSE_SENSITIVITY : float = 0.2
|
||||||
|
@export var TILT_LOWER_LIMIT := deg_to_rad(-90.0)
|
||||||
|
@export var TILT_UPPER_LIMIT := deg_to_rad(90.0)
|
||||||
|
@export var CAMERA_CONTROLLER : Camera3D
|
||||||
|
|
||||||
|
func _input(event: InputEvent) -> void:
|
||||||
|
if event.is_action_pressed("Quit"):
|
||||||
|
get_tree().quit()
|
||||||
|
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||||
|
|
||||||
|
func _unhandled_input(event: InputEvent) -> void:
|
||||||
|
_mouse_input = event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED
|
||||||
|
if _mouse_input:
|
||||||
|
_rotation_input = -event.relative.x * MOUSE_SENSITIVITY
|
||||||
|
_tilt_input = -event.relative.y * MOUSE_SENSITIVITY
|
||||||
|
|
||||||
|
|
||||||
|
func _update_camera(delta):
|
||||||
|
# Rotate the camera using euler rotation
|
||||||
|
_mouse_rotation.x += _tilt_input * delta
|
||||||
|
_mouse_rotation.x = clamp(_mouse_rotation.x, TILT_LOWER_LIMIT, TILT_UPPER_LIMIT)
|
||||||
|
_mouse_rotation.y += _rotation_input * delta
|
||||||
|
|
||||||
|
_player_rotation = Vector3(0.0, _mouse_rotation.y, 0.0)
|
||||||
|
_camera_rotation = Vector3(_mouse_rotation.x, 0.0, 0.0)
|
||||||
|
|
||||||
|
CAMERA_CONTROLLER.transform.basis = Basis.from_euler(_camera_rotation)
|
||||||
|
CAMERA_CONTROLLER.rotation.z = 0.0
|
||||||
|
|
||||||
|
global_transform.basis = Basis.from_euler(_player_rotation)
|
||||||
|
|
||||||
|
_rotation_input = 0.0
|
||||||
|
_tilt_input = 0.0
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
# Add the gravity.
|
||||||
|
if not is_on_floor():
|
||||||
|
velocity += get_gravity() * delta
|
||||||
|
|
||||||
|
_update_camera(delta)
|
||||||
|
|
||||||
|
# Handle jump.
|
||||||
|
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
|
||||||
|
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("Left", "Right", "Forward", "Back")
|
||||||
|
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||||
|
if direction:
|
||||||
|
velocity.x = direction.x * SPEED
|
||||||
|
velocity.z = direction.z * SPEED
|
||||||
|
else:
|
||||||
|
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||||
|
velocity.z = move_toward(velocity.z, 0, SPEED)
|
||||||
|
|
||||||
|
move_and_slide()
|
||||||
1
scripts/fps_controller.gd.uid
Normal file
1
scripts/fps_controller.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dpbe5stprhgay
|
||||||
Loading…
Add table
Add a link
Reference in a new issue