feat: final modifications for building

This commit is contained in:
Sara 2025-03-05 08:34:23 +01:00 committed by Sara
parent 75736b2528
commit 60fd92d827
29 changed files with 313 additions and 170 deletions

View file

@ -11,7 +11,7 @@ script/source = "extends Area3D
func _on_body_entered(body: Node3D) -> void:
if body is Player:
self.get_tree().change_scene_to_file(\"res://end_stage.tscn\")
self.get_tree().call_deferred(\"change_scene_to_file\", \"res://end_stage.tscn\")
"
[sub_resource type="BoxShape3D" id="BoxShape3D_dbwyx"]

BIN
godot/builds.zip Normal file

Binary file not shown.

104
godot/export_presets.cfg Normal file
View file

@ -0,0 +1,104 @@
[preset.0]
name="Linux"
platform="Linux"
runnable=true
advanced_options=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="build/linux/agoraphobia.x86_64"
encryption_include_filters=""
encryption_exclude_filters=""
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=false
texture_format/s3tc_bptc=true
texture_format/etc2_astc=false
binary_format/architecture="x86_64"
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="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
rm -rf \"{temp_dir}\""
[preset.1]
name="Windows Desktop"
platform="Windows Desktop"
runnable=true
advanced_options=false
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="build/windows/agoraphobia.exe"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_export_mode=2
[preset.1.options]
custom_template/debug=""
custom_template/release=""
debug/export_console_wrapper=0
binary_format/embed_pck=false
texture_format/s3tc_bptc=true
texture_format/etc2_astc=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=""
application/product_name=""
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
$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}'"

View file

@ -442,10 +442,10 @@ transform = Transform3D(-0.812226, 0, 0.583343, 0, 1, 0, -0.583343, 0, -0.812226
transform = Transform3D(0.938409, 0, 0.345527, 0, 1, 0, -0.345527, 0, 0.938409, 6.67229, 0.532771, -16.2797)
[node name="Label3D" type="Label3D" parent="."]
transform = Transform3D(0.711254, 0, -0.702936, 0, 1, 0, 0.702936, 0, 0.711254, -0.169304, 2.02161, -16.2403)
transform = Transform3D(0.711254, 0, -0.702936, 0, 1, 0, 0.702936, 0, 0.711254, 0.0794151, 2.02161, -15.9945)
double_sided = false
text = "Swap the camera position
by pressing down the left stick"
by pressing Y"
horizontal_alignment = 0
[node name="Label3D2" type="Label3D" parent="."]

View file

@ -602,9 +602,6 @@ transform = Transform3D(0.960021, -5.59801e-07, -0.279929, 5.4961e-07, 1, -1.149
[node name="dirtpile_large7" parent="." instance=ExtResource("12_pinbc")]
transform = Transform3D(0.976639, -5.59801e-07, -0.214888, 5.5608e-07, 1, -7.7766e-08, 0.214888, -4.35461e-08, 0.976639, 53.5943, 2.82825, -16.1708)
[node name="sandbag_wall_halfheight6" parent="." instance=ExtResource("8_yv3ot")]
transform = Transform3D(-0.959057, -0.119151, 0.256931, -0.12329, 0.992371, 1.86265e-09, -0.25497, -0.0316769, -0.96643, 53.8758, -0.584591, -8.90549)
[node name="barrel6" parent="." instance=ExtResource("14_4cbf0")]
transform = Transform3D(-0.0227921, 0, 0.99974, 0, 1, 0, -0.99974, 0, -0.0227921, 52.734, -0.558583, -11.8994)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=3 uid="uid://7f56u7yednl"]
[gd_scene load_steps=17 format=3 uid="uid://7f56u7yednl"]
[ext_resource type="PackedScene" uid="uid://b5inibbfdco0d" path="res://models/props/trenchwall_2m.glb" id="1_b4gu0"]
[ext_resource type="PackedScene" uid="uid://brdhoy3efmba" path="res://models/props/trenchfloor.glb" id="2_i7akv"]
@ -7,7 +7,6 @@
[ext_resource type="PackedScene" uid="uid://dtp0keenxj1v5" path="res://models/props/trenchwall_2m_dirt.glb" id="5_s14vn"]
[ext_resource type="PackedScene" uid="uid://c71yj2qpupn33" path="res://models/props/dirtpile_large.glb" id="6_eff2e"]
[ext_resource type="PackedScene" uid="uid://dr36mbxtofbv2" path="res://models/props/dirtpile_tall.glb" id="7_oxsr2"]
[ext_resource type="PackedScene" uid="uid://cv5ikndnvmwlo" path="res://models/props/dirtpile_wall_large.glb" id="8_w1mqn"]
[ext_resource type="PackedScene" uid="uid://c3lyv31a5eypw" path="res://models/props/wood_pole.glb" id="9_p0g7q"]
[ext_resource type="PackedScene" uid="uid://d30ah06xgjpn8" path="res://models/props/walkover_thin.glb" id="10_2bnbb"]
[ext_resource type="PackedScene" uid="uid://csvq8g0eu10lq" path="res://objects/lantern.tscn" id="11_5e1nx"]
@ -214,7 +213,7 @@ transform = Transform3D(-0.946649, 4.13794e-08, 0.322266, 2.96247e-08, 1, -4.137
transform = Transform3D(-0.946649, 4.13794e-08, 0.322266, 2.96247e-08, 1, -4.13794e-08, -0.322266, -2.96247e-08, -0.946649, 45.3486, -0.0939861, -28.8812)
[node name="trenchfloor12" parent="." instance=ExtResource("2_i7akv")]
transform = Transform3D(-0.946649, 0.109888, 0.302952, 2.98023e-08, 0.940068, -0.340987, -0.322266, -0.322795, -0.889915, 46.2023, -0.380892, -31.389)
transform = Transform3D(-0.946649, 0.0938821, 0.308288, 2.98023e-08, 0.956626, -0.29132, -0.322266, -0.275778, -0.905589, 46.1833, -0.574865, -31.3331)
[node name="trenchfloor49" parent="." instance=ExtResource("2_i7akv")]
transform = Transform3D(-0.946649, 0.0530672, 0.317867, 3.07336e-08, 0.986349, -0.164669, -0.322266, -0.155884, -0.933726, 47.1418, -0.930335, -33.0743)
@ -367,7 +366,7 @@ transform = Transform3D(-0.337178, 0, -0.941441, 0, 1, 0, 0.941441, 0, -0.337178
transform = Transform3D(-0.915164, -3.17197e-08, -0.403082, -2.35324e-08, 1, -2.52646e-08, 0.403082, -1.36357e-08, -0.915164, 44.1312, -0.65962, -26.7032)
[node name="trenchwall_2m_dirt26" parent="." instance=ExtResource("5_s14vn")]
transform = Transform3D(0.261903, -2.99939e-06, 0.965094, -4.64079e-06, 1, 4.36727e-06, -0.965094, -5.6226e-06, 0.261903, 45.7135, -1.0722, -27.1831)
transform = Transform3D(0.203596, 0.164748, 0.965094, -0.629053, 0.777363, 4.36045e-06, -0.750227, -0.607096, 0.261903, 45.5445, -1.33745, -22.3661)
[node name="trenchwall_2m_dirt5" parent="." instance=ExtResource("5_s14vn")]
transform = Transform3D(-0.999484, -4.16039e-08, 0.0321261, -4.2556e-08, 1, -2.89503e-08, -0.0321261, -3.03025e-08, -0.999484, 43.6712, -0.65962, -28.2737)
@ -550,7 +549,7 @@ transform = Transform3D(0.273169, 0, 0.961966, 0, 1, 0, -0.961966, 0, 0.273169,
transform = Transform3D(0.273169, 0, 0.961966, 0, 1, 0, -0.961966, 0, 0.273169, 53.7086, -0.756105, -40.3299)
[node name="dirtpile_large" parent="." instance=ExtResource("6_eff2e")]
transform = Transform3D(0.992062, 0.122467, -0.0285532, -0.120422, 0.990605, 0.0648127, 0.0362223, -0.0608598, 0.997489, 47.3347, 0.178042, -29.066)
transform = Transform3D(0.992062, 0.122467, -0.0285532, -0.120422, 0.990605, 0.0648127, 0.0362223, -0.0608598, 0.997489, 47.2956, -0.137874, -29.0466)
[node name="dirtpile_large2" parent="." instance=ExtResource("6_eff2e")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45.0203, -2.38419e-07, -30.4474)
@ -633,21 +632,6 @@ transform = Transform3D(-0.141199, 0.379726, -0.91426, 0.474972, 0.836265, 0.273
[node name="dirtpile_large8" parent="." instance=ExtResource("6_eff2e")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 47.9276, -1.07907, -35.2232)
[node name="dirtpile_tall2" parent="." instance=ExtResource("7_oxsr2")]
transform = Transform3D(0.328669, 0, 0.944445, 0, 1, 0, -0.944445, 0, 0.328669, 46.5742, -0.150827, -28.4307)
[node name="dirtpile_tall9" parent="." instance=ExtResource("7_oxsr2")]
transform = Transform3D(0.328669, 0, 0.944445, 0, 1, 0, -0.944445, 0, 0.328669, 46.9865, -0.150827, -28.8672)
[node name="dirtpile_tall10" parent="." instance=ExtResource("7_oxsr2")]
transform = Transform3D(0.328669, 0, 0.944445, 0, 1, 0, -0.944445, 0, 0.328669, 45.2118, -0.150827, -29.5311)
[node name="dirtpile_tall8" parent="." instance=ExtResource("7_oxsr2")]
transform = Transform3D(0.328669, 0, 0.944445, 0, 1, 0, -0.944445, 0, 0.328669, 46.6056, 0.531374, -28.7781)
[node name="dirtpile_tall11" parent="." instance=ExtResource("7_oxsr2")]
transform = Transform3D(0.105778, 9.98611e-07, 0.99439, -1.95225e-07, 1, -9.83478e-07, -0.99439, -9.00988e-08, 0.105778, 44.8342, 0.350565, -29.0432)
[node name="dirtpile_tall5" parent="." instance=ExtResource("7_oxsr2")]
transform = Transform3D(0.999979, 0, -0.00654481, 0, 1, 0, 0.00654481, 0, 0.999979, 50.2777, -0.752672, -26.3643)
@ -705,26 +689,17 @@ transform = Transform3D(0.989478, 0, -0.144684, 0, 1, 0, 0.144684, 0, 0.989478,
[node name="dirtpile_tall6" parent="." instance=ExtResource("7_oxsr2")]
transform = Transform3D(0.973219, 0, 0.22988, 0, 1, 0, -0.22988, 0, 0.973219, 50.5939, -0.560426, -24.8302)
[node name="dirtpile_tall3" parent="." instance=ExtResource("7_oxsr2")]
transform = Transform3D(0.10911, 0, 0.99403, 0, 1, 0, -0.99403, 0, 0.10911, 45.0687, -0.24348, -28.7661)
[node name="dirtpile_tall4" parent="." instance=ExtResource("7_oxsr2")]
transform = Transform3D(0.10911, 0.222932, 0.968709, -1.86265e-09, 0.974527, -0.224271, -0.99403, 0.0244701, 0.10633, 43.3581, -0.0490787, -28.9539)
[node name="dirtpile_wall_large" parent="." instance=ExtResource("8_w1mqn")]
transform = Transform3D(-0.940537, -2.12558e-06, -0.33969, -1.76488e-06, 1, -1.37078e-06, 0.33969, -6.89761e-07, -0.940537, 48.2262, -0.108347, -27.8825)
[node name="sandbag_wall_halfheight20" parent="." instance=ExtResource("3_moect")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 49.97, 0.14027, -26.1735)
transform = Transform3D(0.10911, 0.464262, 0.878952, -3.72529e-09, 0.884231, -0.467051, -0.99403, 0.0509598, 0.0964778, 42.8649, 0.14766, -29.008)
[node name="sandbag_wall_halfheight22" parent="." instance=ExtResource("3_moect")]
transform = Transform3D(-0.294637, 0.0907498, -0.95129, 0.203768, 0.978552, 0.0302388, 0.933631, -0.184933, -0.30681, 46.04, -0.337001, -27.3544)
transform = Transform3D(0.184047, 0.0907498, -0.978719, 0.166021, 0.978552, 0.121954, 0.968795, -0.184933, 0.165032, 46.0306, -0.101085, -26.1107)
[node name="sandbag_wall_halfheight23" parent="." instance=ExtResource("3_moect")]
transform = Transform3D(-0.294637, 0.0907498, -0.95129, 0.203768, 0.978552, 0.0302388, 0.933631, -0.184933, -0.30681, 44.3913, -0.284594, -27.8861)
transform = Transform3D(-0.294637, 0.0907498, -0.95129, 0.203768, 0.978552, 0.0302388, 0.933631, -0.184933, -0.30681, 42.9254, 1.08005, -24.2042)
[node name="sandbag_wall_halfheight21" parent="." instance=ExtResource("3_moect")]
transform = Transform3D(0.937974, 0, -0.346706, 0, 1, 0, 0.346706, 0, 0.937974, 49.97, 0.14027, -24.7845)
transform = Transform3D(0.41709, 0, 0.908866, 0, 1, 0, -0.908866, 0, 0.41709, 48.2388, -0.178077, -24.8442)
[node name="dirtpile_large22" parent="." instance=ExtResource("6_eff2e")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 58.0601, 0.0124512, -39.7073)
@ -925,7 +900,16 @@ transform = Transform3D(0.306609, 0, 0.951836, 0, 1, 0, -0.951836, 0, 0.306609,
transform = Transform3D(0.824225, 0, 0.566262, 0, 1, 0, -0.566262, 0, 0.824225, 49.7462, -1.22467, -34.7325)
[node name="wire6" parent="." instance=ExtResource("14_ml8ps")]
transform = Transform3D(0.34306, 0.099055, 0.934076, -0.434321, 0.898465, 0.0642356, -0.832871, -0.427726, 0.351249, 47.5159, -0.178262, -29.4595)
transform = Transform3D(0.34306, 0.099055, 0.934076, -0.434321, 0.898465, 0.0642356, -0.832871, -0.427726, 0.351249, 44.3715, -0.175195, -27.679)
[node name="wire7" parent="." instance=ExtResource("14_ml8ps")]
transform = Transform3D(-0.812426, 0.0990549, 0.574589, -0.175181, 0.898465, -0.402582, -0.556126, -0.427726, -0.712583, 48.2046, -0.175445, -29.2941)
transform = Transform3D(-0.812426, -0.100855, 0.574276, -0.175181, 0.981643, -0.0754313, -0.556126, -0.161885, -0.815179, 45.0968, -0.50368, -28.6017)
[node name="wire27" parent="." instance=ExtResource("14_ml8ps")]
transform = Transform3D(-0.994656, -0.060181, 0.0838982, -0.0603293, 0.998179, 0.000758968, -0.0837905, -0.00430694, -0.996474, 48.5401, -0.247588, -26.4202)
[node name="wire28" parent="." instance=ExtResource("14_ml8ps")]
transform = Transform3D(-0.122125, -0.282158, -0.951563, 0.155548, 0.941452, -0.299122, 0.980251, -0.184543, -0.0710863, 49.4483, 0.0164385, -26.6326)
[node name="wire29" parent="." instance=ExtResource("14_ml8ps")]
transform = Transform3D(-0.127151, 0.0174548, -0.991729, -0.0199193, 0.999599, 0.0201476, 0.991684, 0.022317, -0.126753, 46.301, -0.235534, -26.8889)

Binary file not shown.

Binary file not shown.

View file

@ -27,7 +27,11 @@ script/source = "extends Button
func _ready() -> void:
self.grab_focus()
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
print(\"Fixing Input\")
Input.add_joy_mapping(
\"0300604ec82d00000a31000014010000,8BitDo Ultimate 2C Wireless Controller,a:b0,b:b1,x:b2,y:b3,back:b6,guide:b8,start:b7,leftstick:b9,rightstick:b10,leftshoulder:b4,rightshoulder:b5,dpup:h0.1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,leftx:a0,lefty:a1,rightx:a3,righty:a4,lefttrigger:a2,righttrigger:a5,platform:Linux,crc:4e60,\",
true
)
func _on_pressed() -> void:
self.get_tree().call_deferred(\"change_scene_to_file\", game_scene)
@ -91,10 +95,8 @@ label_settings = SubResource("LabelSettings_oxg04")
[node name="Button" type="Button" parent="MarginContainer/CenterContainer/PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_horizontal = 0
focus_neighbor_top = NodePath("../Button2")
focus_neighbor_bottom = NodePath("../Button2")
focus_next = NodePath("../Button2")
focus_previous = NodePath("../Button2")
text = "Start Game"
script = SubResource("GDScript_krtn0")
@ -102,8 +104,6 @@ script = SubResource("GDScript_krtn0")
layout_mode = 2
size_flags_horizontal = 0
focus_neighbor_top = NodePath("../Button")
focus_neighbor_bottom = NodePath("../Button")
focus_next = NodePath("../Button")
focus_previous = NodePath(".")
text = "Quit"
script = SubResource("GDScript_iytxh")

Binary file not shown.

View file

@ -1,4 +1,4 @@
[gd_resource type="AnimationNodeBlendTree" load_steps=47 format=3 uid="uid://c7rxfpfy7vt1b"]
[gd_resource type="AnimationNodeBlendTree" load_steps=49 format=3 uid="uid://c7rxfpfy7vt1b"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ukhqm"]
animation = &"Aim"
@ -118,6 +118,9 @@ nodes/Walk/node = SubResource("AnimationNodeAnimation_psu0r")
nodes/Walk/position = Vector2(-140, 300)
node_connections = [&"Speed", 0, &"Base", &"Speed", 1, &"Walk", &"output", 0, &"Speed"]
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1vnoj"]
animation = &"Walk_forward_stagger"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_4lybd"]
switch_mode = 2
advance_mode = 2
@ -156,7 +159,7 @@ advance_mode = 2
advance_expression = "!is_walking || walk_speed <= 0.0"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_4hisb"]
xfade_time = 0.3
xfade_time = 0.6
advance_mode = 2
advance_expression = "is_walking && walk_speed > 0.0"
@ -173,22 +176,17 @@ switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_g0i3x"]
xfade_time = 0.4
xfade_time = 0.7
priority = 2
advance_mode = 2
advance_expression = "get_is_running()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ocffv"]
xfade_time = 0.5
xfade_time = 0.7
advance_mode = 2
advance_expression = "get_is_running()
"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_nymcr"]
xfade_time = 0.5
advance_mode = 2
advance_expression = "!get_is_running()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_g5qf0"]
xfade_time = 0.5
advance_mode = 2
@ -226,6 +224,16 @@ advance_expression = "is_walking && walk_speed > 0.0"
switch_mode = 2
advance_mode = 2
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_1ffo6"]
xfade_time = 0.4
advance_mode = 2
advance_expression = "!get_is_running()"
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8m5hv"]
xfade_time = 0.1
switch_mode = 1
advance_mode = 2
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_7smdg"]
"states/Aim Down [aim]/node" = SubResource("AnimationNodeAnimation_ukhqm")
"states/Aim Down [aim]/position" = Vector2(919.525, 258.767)
@ -239,16 +247,18 @@ states/Hit/position = Vector2(689.503, 14.954)
"states/RESET To Aim/node" = SubResource("AnimationNodeAnimation_ugv1e")
"states/RESET To Aim/position" = Vector2(755.258, 94.3447)
states/Run/node = SubResource("AnimationNodeBlendTree_hmklb")
states/Run/position = Vector2(361.447, 258.767)
states/Run/position = Vector2(221.447, 258.767)
states/Stab/node = SubResource("AnimationNodeAnimation_nur8b")
states/Stab/position = Vector2(361.447, 94.3447)
states/Start/position = Vector2(572.26, 14.954)
"states/Stationary [turn]/node" = SubResource("AnimationNodeBlendTree_p0hk7")
"states/Stationary [turn]/position" = Vector2(572.26, 94.3447)
states/Walk/node = SubResource("AnimationNodeAnimation_1vnoj")
states/Walk/position = Vector2(389.003, 339.767)
"states/Walk [turn]/node" = SubResource("AnimationNodeBlendTree_2mbyh")
"states/Walk [turn]/position" = Vector2(572.26, 258.767)
transitions = ["Aim [aim] [turn]", "Aim Down [aim]", SubResource("AnimationNodeStateMachineTransition_4lybd"), "Aim Down [aim]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_5aafd"), "Aim [aim] [turn]", "Fire [aim]", SubResource("AnimationNodeStateMachineTransition_8f4gl"), "Fire [aim]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_xnat3"), "Walk [turn]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_12bos"), "Aim Down [aim]", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_n0ndr"), "Walk [turn]", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_0wc5e"), "Stationary [turn]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_4hisb"), "Start", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_bmty6"), "Stationary [turn]", "RESET To Aim", SubResource("AnimationNodeStateMachineTransition_kyd6p"), "RESET To Aim", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_w5kob"), "Stationary [turn]", "Run", SubResource("AnimationNodeStateMachineTransition_g0i3x"), "Walk [turn]", "Run", SubResource("AnimationNodeStateMachineTransition_ocffv"), "Run", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_nymcr"), "Run", "Stab", SubResource("AnimationNodeStateMachineTransition_g5qf0"), "Stab", "Run", SubResource("AnimationNodeStateMachineTransition_27kmb"), "Stationary [turn]", "Stab", SubResource("AnimationNodeStateMachineTransition_4q0ot"), "Stab", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_h6ujc"), "Walk [turn]", "Stab", SubResource("AnimationNodeStateMachineTransition_3bu8l"), "Stab", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_cpibo"), "Hit", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_0ppx7")]
graph_offset = Vector2(63.5029, 32.992)
transitions = ["Aim [aim] [turn]", "Aim Down [aim]", SubResource("AnimationNodeStateMachineTransition_4lybd"), "Aim Down [aim]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_5aafd"), "Aim [aim] [turn]", "Fire [aim]", SubResource("AnimationNodeStateMachineTransition_8f4gl"), "Fire [aim]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_xnat3"), "Walk [turn]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_12bos"), "Aim Down [aim]", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_n0ndr"), "Walk [turn]", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_0wc5e"), "Stationary [turn]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_4hisb"), "Start", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_bmty6"), "Stationary [turn]", "RESET To Aim", SubResource("AnimationNodeStateMachineTransition_kyd6p"), "RESET To Aim", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_w5kob"), "Stationary [turn]", "Run", SubResource("AnimationNodeStateMachineTransition_g0i3x"), "Walk [turn]", "Run", SubResource("AnimationNodeStateMachineTransition_ocffv"), "Run", "Stab", SubResource("AnimationNodeStateMachineTransition_g5qf0"), "Stab", "Run", SubResource("AnimationNodeStateMachineTransition_27kmb"), "Stationary [turn]", "Stab", SubResource("AnimationNodeStateMachineTransition_4q0ot"), "Stab", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_h6ujc"), "Walk [turn]", "Stab", SubResource("AnimationNodeStateMachineTransition_3bu8l"), "Stab", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_cpibo"), "Hit", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_0ppx7"), "Run", "Walk", SubResource("AnimationNodeStateMachineTransition_1ffo6"), "Walk", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_8m5hv")]
graph_offset = Vector2(-92.9971, -144.008)
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_au62i"]
animation = &"Fall_die"
@ -258,7 +268,7 @@ animation = &"Fall_die"
[sub_resource type="AnimationNodeTimeSeek" id="AnimationNodeTimeSeek_p56ym"]
[resource]
graph_offset = Vector2(-335.5, 163.5)
graph_offset = Vector2(-317.5, 155.5)
nodes/Actions/node = SubResource("AnimationNodeStateMachine_7smdg")
nodes/Actions/position = Vector2(0, 140)
nodes/Death/node = SubResource("AnimationNodeAnimation_au62i")

BIN
godot/models/items/bolt_action_rifle.blend (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,51 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://c1xonxsp3ervk"
path="res://.godot/imported/bolt_action_rifle.blend-53deefa8912a6ffa7c0396d9d7f75a92.scn"
[deps]
source_file="res://models/items/bolt_action_rifle.blend"
dest_files=["res://.godot/imported/bolt_action_rifle.blend-53deefa8912a6ffa7c0396d9d7f75a92.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
_subresources={}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true

Binary file not shown.

View file

@ -113,7 +113,7 @@ bone_idx = 44
blood_effect = ExtResource("2_eblpx")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -8.84754e-09, 0.268834, 0.0479187)
enabled = false
target_position = Vector3(0, 15, 0)
target_position = Vector3(0, 17, 0)
collision_mask = 7
[node name="MuzzleAudio" type="AudioStreamPlayer3D" parent="skeleton_character/Skeleton3D/BoneAttachment3D" index="1"]
@ -126,11 +126,11 @@ max_distance = 321.41
max_polyphony = 3
panning_strength = 0.82
[node name="BayonetHitscan" type="HitscanMuzzle" parent="skeleton_character/Skeleton3D/BoneAttachment3D" index="2"]
[node name="BayonetHitscan" type="HitscanMuzzle" parent="skeleton_character" index="1"]
blood_effect = ExtResource("2_eblpx")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.91257e-05, -0.0191353, -0.00675189)
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -0.00820574, 1.40269, 0.117156)
enabled = false
target_position = Vector3(0, 2.468, 0)
target_position = Vector3(0, 1.855, 0)
collision_mask = 7
debug_shape_thickness = 3

View file

@ -14,78 +14,6 @@ collision_layer = 6
[node name="CharacterModel" parent="." instance=ExtResource("1_i7aop")]
unique_name_in_owner = true
[node name="Skeleton3D" parent="CharacterModel/skeleton_character" index="0"]
bones/0/rotation = Quaternion(1.12928e-22, 1, 2.98023e-08, -1.94707e-07)
bones/1/position = Vector3(3.1225e-17, 0.826102, -2.26306e-09)
bones/1/rotation = Quaternion(-0.0189874, -6.30661e-09, -1.08732e-09, 0.99982)
bones/2/rotation = Quaternion(0.0262842, 8.66579e-09, 1.56723e-09, 0.999655)
bones/3/rotation = Quaternion(-0.013812, -0.124595, 8.42949e-05, 0.992112)
bones/4/rotation = Quaternion(0.0100466, -3.89644e-10, 6.78268e-10, 0.99995)
bones/5/rotation = Quaternion(-0.0233085, 0.0669743, -0.00156502, 0.997481)
bones/6/rotation = Quaternion(0.623077, 0.672557, 0.307599, -0.254607)
bones/7/rotation = Quaternion(-0.311931, -0.528262, 0.360764, 0.702487)
bones/8/rotation = Quaternion(0.385362, 0.19105, 0.552644, 0.713849)
bones/9/rotation = Quaternion(0.204715, 0.0914037, 0.275611, 0.93476)
bones/10/rotation = Quaternion(-0.160687, -0.0459478, -0.0475321, 0.984789)
bones/11/rotation = Quaternion(-0.030518, -0.0130498, -0.0216154, 0.999215)
bones/12/rotation = Quaternion(0.0087248, 0.00565774, 0.0013103, 0.999945)
bones/13/rotation = Quaternion(-0.617934, -0.0462445, 0.180663, 0.763793)
bones/14/rotation = Quaternion(-0.23045, 0.0743406, 0.160693, 0.956841)
bones/15/rotation = Quaternion(-0.541263, -0.00752765, 0.238029, 0.806424)
bones/16/rotation = Quaternion(-0.611024, -0.262913, 0.402215, 0.629087)
bones/17/rotation = Quaternion(0.0158022, 0.0368156, 0.177499, 0.983305)
bones/18/rotation = Quaternion(-0.115784, 0.0786986, 0.503797, 0.852402)
bones/19/rotation = Quaternion(-0.77808, 0.139756, 0.0140334, 0.612261)
bones/20/rotation = Quaternion(-0.0923591, 0.0238578, 0.0736642, 0.992711)
bones/21/rotation = Quaternion(-0.193467, 0.101022, 0.0447897, 0.974864)
bones/22/rotation = Quaternion(-0.293695, -0.10649, 0.259809, 0.91373)
bones/23/rotation = Quaternion(-0.0310475, -0.0162325, -0.00151601, 0.999385)
bones/24/rotation = Quaternion(0.140362, -0.0289769, -0.195164, 0.970242)
bones/25/rotation = Quaternion(0.585184, -0.476496, -0.473244, -0.454479)
bones/26/rotation = Quaternion(-0.449756, 0.301541, -0.311322, 0.780943)
bones/27/rotation = Quaternion(-0.122233, -0.135947, -0.565028, 0.804562)
bones/28/rotation = Quaternion(0.155388, -0.432411, -0.521703, 0.71882)
bones/29/rotation = Quaternion(-0.0486368, 0.0590466, -0.0759536, 0.994173)
bones/30/rotation = Quaternion(-0.0305179, 0.0130499, 0.0216153, 0.999215)
bones/31/rotation = Quaternion(-0.518356, -0.00412336, -0.00408935, 0.855145)
bones/32/rotation = Quaternion(-0.290993, 0.0788459, 0.0248015, 0.953148)
bones/33/rotation = Quaternion(-0.419789, -0.067382, -0.039477, 0.904256)
bones/34/rotation = Quaternion(-0.266884, 0.00530696, 0.000658852, 0.963714)
bones/35/rotation = Quaternion(-0.422483, 0.214372, -0.00100308, 0.880654)
bones/36/rotation = Quaternion(-0.345783, -0.0439312, -0.261553, 0.900052)
bones/37/rotation = Quaternion(-0.0107009, 0.0076969, 0.00365465, 0.999906)
bones/38/rotation = Quaternion(-0.389883, 0.108139, -0.120461, 0.906525)
bones/39/rotation = Quaternion(-0.399909, -0.0921328, -0.130163, 0.902575)
bones/40/rotation = Quaternion(-0.0125688, 0.0114118, 0.00134583, 0.999855)
bones/41/rotation = Quaternion(-0.0497163, 0.0839878, -0.166226, 0.981246)
bones/42/rotation = Quaternion(-0.0310475, 0.0162325, 0.00151601, 0.999385)
bones/43/rotation = Quaternion(-0.00109124, -0.0104143, 0.0283538, 0.999543)
bones/44/position = Vector3(0.16719, 0.195796, -0.0454406)
bones/44/rotation = Quaternion(-0.610992, 0.0971646, 0.14821, 0.771545)
bones/45/rotation = Quaternion(-0.82326, 4.1804e-09, -1.03579e-07, 0.567665)
bones/46/position = Vector3(8.07956e-09, 0.0363644, 0.0392254)
bones/46/rotation = Quaternion(-0.00112372, -6.23921e-08, 6.44731e-09, 0.999999)
bones/48/rotation = Quaternion(0.706312, -2.55434e-08, 6.24918e-08, 0.707901)
bones/49/position = Vector3(0.0228929, -0.0282939, -0.00824324)
bones/49/rotation = Quaternion(-0.112129, 0.585203, -0.155744, 0.78785)
bones/50/position = Vector3(-0.0246244, 0.246628, -0.0197923)
bones/50/rotation = Quaternion(0.31578, 0.920316, 0.115311, -0.200014)
bones/51/position = Vector3(0.0902225, 0.042579, 0.00142519)
bones/51/rotation = Quaternion(0.997309, -0.00549226, 0.0715033, -0.0152251)
bones/52/rotation = Quaternion(-0.00225666, 0.00306653, -0.000453776, 0.999993)
bones/53/rotation = Quaternion(0.665461, 0.000165138, -0.00238783, 0.746429)
bones/54/position = Vector3(-0.0902225, 0.042579, 0.00142518)
bones/54/rotation = Quaternion(0.997309, 0.00549227, -0.0715033, -0.0152251)
bones/55/rotation = Quaternion(-0.00225666, -0.0030665, 0.000453778, 0.999993)
bones/56/rotation = Quaternion(0.665461, -0.000165001, 0.00238774, 0.746429)
bones/57/position = Vector3(3.64125e-07, 0.0462301, -0.935059)
bones/58/rotation = Quaternion(-2.99921e-13, 0.707107, 0.707107, -2.99921e-13)
bones/59/rotation = Quaternion(2.01446e-13, 0.707107, 0.707107, 2.01446e-13)
bones/60/rotation = Quaternion(-0.707107, 1.25097e-07, 1.25097e-07, 0.707107)
bones/61/rotation = Quaternion(-0.707107, 1.25097e-07, 1.25097e-07, 0.707107)
bones/62/rotation = Quaternion(-0.707107, 1.5189e-07, 1.5189e-07, 0.707107)
bones/63/rotation = Quaternion(-0.707107, 1.5189e-07, 1.5189e-07, 0.707107)
[node name="mesh_helmet_a" parent="CharacterModel/skeleton_character/Skeleton3D" index="1"]
visible = false

File diff suppressed because one or more lines are too long

Binary file not shown.

View file

@ -15,10 +15,15 @@ warnings/check_invalid_track_paths=false
[application]
config/name="trenches"
config/tags=PackedStringArray("game", "school")
run/main_scene="res://main_menu.tscn"
config/features=PackedStringArray("4.3", "Forward Plus")
config/icon="res://icon.svg"
[autoload]
SetupInput="*res://setup_input.gd"
[display]
window/size/viewport_width=1920
@ -57,23 +62,23 @@ dir_backward={
dir_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)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null)
]
}
dir_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)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null)
]
}
look_up={
"deadzone": 0.2,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":4,"axis_value":-1.0,"script":null)
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null)
]
}
look_down={
"deadzone": 0.2,
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":4,"axis_value":1.0,"script":null)
"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null)
]
}
fire={
@ -91,7 +96,7 @@ run={
switch_shoulder={
"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":4194306,"key_label":0,"unicode":0,"location":0,"echo":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(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":true,"script":null)
]
}

6
godot/setup_input.gd Normal file
View file

@ -0,0 +1,6 @@
@tool
extends Node
func _ready() -> void:
if not Engine.is_editor_hint():
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED

BIN
models/rifle.blend (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

View file

@ -59,7 +59,7 @@ void ArtilleryTarget::timer_end() {
this->add_child(instance);
if(gd::Node3D *inst3d{gd::Object::cast_to<gd::Node3D>(instance)}) {
double const distance{gd::Math::sqrt(gd::UtilityFunctions::randf_range(0.f, 1.f) * this->spread)};
double const angle{gd::UtilityFunctions::randf_range(0., M_2_PI)};
double const angle{gd::UtilityFunctions::randf_range(0.f, 2.f/Math_PI)};
inst3d->set_global_position(this->get_global_position() + gd::Vector3{1.f, 0.f, 0.f}.rotated({0.f, 1.f, 0.f}, angle) * distance);
}
}

View file

@ -3,7 +3,6 @@
#include "utils/util_functions.hpp"
#include <godot_cpp/variant/utility_functions.hpp>
void CameraEffects::_bind_methods() {
#define CLASSNAME CameraEffects
}
@ -37,7 +36,7 @@ void CameraEffects::_process(double delta [[maybe_unused]]) {
}
float const current_y{this->spring->get_rotation().y};
float diff{gd::Math::wrapf(this->target_rotation - current_y, -M_2_PIf, M_2_PI)};
float diff{gd::Math::wrapf(this->target_rotation - current_y, -(2.f/Math_PI), 2.f/Math_PI)};
float const step(gd::Math::sign(diff) * delta * this->SHOULDER_SWITCH_SPEED);
this->spring->rotate_y(gd::Math::abs(step) < gd::Math::abs(diff) ? step : diff);

View file

@ -37,7 +37,7 @@ void Enemy::_process(double delta) {
// update debuging label
this->set_current_state_name(this->current_state_name);
// rotate towards target (defined by either aiming or navigation)
float const angle_left{gd::Math::wrapf(this->target_rotation - this->get_rotation().y, -M_PIf, M_PIf)};
float const angle_left{gd::Math::wrapf(this->target_rotation - this->get_rotation().y, -Math_PI, Math_PI)};
float const step(gd::Math::sign(angle_left) * delta * (this->anim_tree->get_current_state().begins_with("Run") ? this->TURN_SPEED : this->AIM_SPEED));
if(gd::Math::abs(angle_left) <= gd::Math::abs(step)) {
this->rotate_y(angle_left);
@ -109,11 +109,11 @@ Enemy::ActionFn Enemy::wait_end_of_shot() {
Enemy::ActionFn Enemy::stab() {
this->set_current_state_name("Stab (start)");
this->anim_tree->set_aim_weapon(false);
if(this->anim_tree->get_current_state().begins_with("Aim"))
return (ActionFn)&Enemy::stab;
this->anim_tree->set_stab();
float const target_diff{this->get_global_basis().get_column(2).signed_angle_to(this->last_known_player_position - this->aim_offset_position(), {0.f, 1.f, 0.f})};
this->target_rotation = this->get_global_rotation().y + target_diff;
if(this->anim_tree->get_current_state().begins_with("Aim") || !this->at_target_angle)
return (ActionFn)&Enemy::stab;
this->anim_tree->set_stab();
return (ActionFn)&Enemy::wait_end_of_stab;
}

17
src/enemy_state.cpp Normal file
View file

@ -0,0 +1,17 @@
#include "enemy_state.hpp"
EnemyState const *EnemyState::get_next() {
return this->next_state;
}
void EnemyState::set_next(EnemyState const *state) {
this->next_state = state;
}
EnemyState const *EnemyStateDB::get_state_by_name(gd::StringName name) {
return EnemyStateDB::states.has(name)
? &EnemyStateDB::states.get(name)
: nullptr;
}
gd::HashMap<gd::StringName, EnemyState> EnemyStateDB::states{};

47
src/enemy_state.hpp Normal file
View file

@ -0,0 +1,47 @@
#ifndef ENEMY_STATE_HPP
#define ENEMY_STATE_HPP
#include "enemy.hpp"
#include "godot_cpp/templates/hash_map.hpp"
#include <godot_cpp/classes/ref_counted.hpp>
namespace gd = godot;
class EnemyState {
public:
static gd::StringName get_static_state_name() {
return gd::StringName("EnemyState");
}
virtual gd::StringName get_state_name() const {
return gd::StringName("EnemyState");
}
virtual void process(Enemy *enemy) {}
EnemyState const *get_next();
protected:
void set_next(EnemyState const *state);
private:
EnemyState const *next_state{};
};
#define ENEMY_STATE(m_state_name)\
friend class EnemyStateDB;\
static godot::StringName get_static_state_name() { return godot::StringName(#m_state_name); }\
virtual godot::StringName get_state_name() const { return godot::StringName(#m_state_name); }
class EnemyStateDB {
public:
template<class TState> static void register_state() {
if(!EnemyStateDB::states.has(TState::get_static_state_name())) {
EnemyState state{new TState()};
EnemyStateDB::states.insert(state.get_state_name(), state);
}
}
static EnemyState const *get_state_by_name(gd::StringName name);
template<class TState> static EnemyState const *get_state() {
return EnemyStateDB::get_state_by_name(TState::get_static_state_name());
}
private:
static gd::HashMap<gd::StringName, EnemyState> states;
};
#endif // !ENEMY_STATE_HPP

View file

@ -69,17 +69,22 @@ void Player::process_transform_camera(double delta) {
this->camera_parent->set_global_position(this->get_global_position() + gd::Vector3{0.f, this->camera_height, 0.f});
float const camera_speed{float(delta) * (this->anim_tree->match_tags(PlayerAnimTree::Aim) ? this->AIMING_CAMERA_ROTATION_SPEED : this->CAMERA_ROTATION_SPEED)};
this->camera_parent->global_rotate({0.f, 1.f, 0.f}, this->input_directions.x * -camera_speed);
// collect the forward and left axes from the basis
gd::Basis const basis{this->camera_parent->get_global_basis()};
gd::Vector3 const camera_forward{basis.get_column(2)};
gd::Vector3 const left{basis.get_column(0)};
// get the angle between the camera and character forward around the character's left axis
float const v_angle{camera_forward.signed_angle_to(gd::Vector3{camera_forward.x, 0.f, camera_forward.z}.normalized(), left)};
// calculate a centering force to keep the camera point horizontally
float const max_frame_movement(gd::Math::abs(v_angle) / delta);
float const counter_speed(gd::Math::clamp((v_angle / this->CAMERA_VERTICAL_LIMIT) * this->CAMERA_VERTICAL_ROTATION_SPEED, -max_frame_movement, max_frame_movement));
// calculate force from input
float const input_speed{this->input_look_vertical * this->CAMERA_VERTICAL_ROTATION_SPEED};
// combine input and centering force to produce rotation this frame
this->camera_parent->global_rotate(left, (input_speed + counter_speed) * delta);
}
void Player::process_rotate(double delta) {
void Player::process_rotate(double delta) {
if(this->anim_tree->match_tags(PlayerAnimTree::Tags::Turn)) {
//! the signed angle difference between the left axes of the camera parent and Player
float const diff{-this->camera_parent->get_global_basis().get_column(0).signed_angle_to(this->get_global_basis().get_column(0), {0.f, 1.f, 0.f})};
@ -89,7 +94,7 @@ void Player::process_rotate(double delta) {
float const actual_speed{speed < gd::Math::abs(diff) ? dir * speed : diff};
// rotate by max allowed or full difference, whichever has the smaller magnitude
this->rotate_y(actual_speed);
this->anim_tree->set_target_turn_speed(gd::Math::clamp(diff * 2.f, -1.f, 1.f) * M_PI_2f *0.9f);
this->anim_tree->set_target_turn_speed(gd::Math::clamp(diff * 2.f, -1.f, 1.f) * Math_PI/2.f *0.9f);
}
}

View file

@ -38,7 +38,7 @@ void PlayerAnimTree::_process(double delta) {
}
// rotational root motion
this->parent_3d->set_quaternion(this->get_root_motion_rotation_accumulator());
this->parent_3d->rotate_y(M_PIf);
this->parent_3d->rotate_y(Math_PI);
this->update_tags(this->fsm->get_current_node());
}