Add some effects for walking

This commit is contained in:
Sofia 2026-07-24 01:34:11 +03:00
parent 0f3736a568
commit b44179eb24
20 changed files with 413 additions and 54 deletions

View File

@ -1,5 +1,6 @@
- [Sound effects](godot/raw_assets/sfx/) from [zapsplat.com](https://www.zapsplat.com/)
- [LaserFast and LaserWithRecovery](godot/raw_assets/sfx/)
- [Hit](godot/raw_assets/sfx/Hit.mp3)
- [Footstep sounds on Tree Trunk](godot/raw_assets/sfx/footsteps/) via [zapsplat](https://www.zapsplat.com/sound-effect-packs/footsteps-on-fallen-tree-trunk)
- [Soldier model and rig](godot/raw_assets/Soldier/) by [Casti_131](https://opengameart.org/content/low-poly-soldier-with-weapons)
- [Torment Textures](godot/maps/textures) (`str_*` files) by [Bradley D. (strideh.itch.io)](https://strideh.itch.io)

View File

@ -0,0 +1,46 @@
Important: Please read this information below carefully. You must agree to these License Terms before using our sound effects
License: Standard License Agreement
FOR BASIC MEMBERS (GOLD MEMBERS CAN IGNORE THIS STATEMENT)
If you have not upgraded your Zapsplat.com account to a Gold Account, you are required to attribute zapsplat.com in the form of a credit/link back to our website if you use our sound effects. Please make sure you include our website as follows: https://www.zapsplat.com You can remove this requirement by making a small donation (you choose how much) at https://www.zapsplat.com/donate-and-upgrade
What you can use our free sound effects and music for:
You can use our sound effects and music in any non-commercial, commercial and broadcast production, including:
Films, television and radio programmes
Commercials
Podcasts
Games and apps
Within software
YouTube videos
Blogs and websites
School projects
Presentations, conferences, exhibitions etc
Theatrical performances and live shows
Within physical products such as toys
Sound effects and music must be embedded into your production and not used as standalone sounds in isolation (in a sound effect app for example).
What you cant use our free sound effects and music for:
You may not use our sound effects and music for the following purposes under any circumstances:
Our sound effects must not be shared with any person.
Our sound effects must not be distributed in any form including on other websites, on social networks, file sharing platforms, CD, DVD or any other ROM.
Our sound effects can not be loaned, rented, sub-licensed or sold to any third party.
We (or our contributors) retain the copyright to the sound effects and music at all times. Sound effects and music are licensed to you on a non-exclusive basis and subject to the terms detailed above.
Indemnification
The Licensee agrees to indemnify ZapSplat.com from any claims, law-suits, damages and any liabilities including reasonable expenses and legal fees incurred relating to any matter that may arise if this licence agreement is breached.
Disclaimer of Warranties
Zapsplat.com provides the sound effects and music files on this website on an as-is basis and provides no warranties or conditions of any kind. While we have taken absolute care and precautions to ensure the sound effects we provide are error free, we will not be liable for any loss or damage to your systems as a result of downloading and using our sound effects.
Limitation of Liability
The Licensee agrees that Zapsplat.com holds no liability with regards to any claims made in relation to this agreement.
For any questions regarding your intended use of our sound effects, please contact us
Thank you and enjoy our free sound effects and music.

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://b3xnffwvltdey"
path="res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_001_23222.mp3-ef116d01166d06ec8247f3be8605c785.mp3str"
[deps]
source_file="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_001_23222.mp3"
dest_files=["res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_001_23222.mp3-ef116d01166d06ec8247f3be8605c785.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://c7cs50q27v680"
path="res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_002_23223.mp3-522468e10f46ac172c1198c0067f0060.mp3str"
[deps]
source_file="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_002_23223.mp3"
dest_files=["res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_002_23223.mp3-522468e10f46ac172c1198c0067f0060.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bq4xb5qcy7uif"
path="res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_003_23224.mp3-f189df66359754fe4989c41c4d5953c5.mp3str"
[deps]
source_file="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_003_23224.mp3"
dest_files=["res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_003_23224.mp3-f189df66359754fe4989c41c4d5953c5.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://xj7u5c1ifip0"
path="res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_004_23225.mp3-6e9dc3256a3e193b7840867c9c6c6f5e.mp3str"
[deps]
source_file="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_004_23225.mp3"
dest_files=["res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_004_23225.mp3-6e9dc3256a3e193b7840867c9c6c6f5e.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://dqnaty4lxm4bd"
path="res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_005_23226.mp3-51dc73f38e799a6057b2b38dd126fba8.mp3str"
[deps]
source_file="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_005_23226.mp3"
dest_files=["res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_005_23226.mp3-51dc73f38e799a6057b2b38dd126fba8.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://kvknfhu2yuty"
path="res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_006_23227.mp3-74f162942b602926126560372e84bbe6.mp3str"
[deps]
source_file="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_006_23227.mp3"
dest_files=["res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_006_23227.mp3-74f162942b602926126560372e84bbe6.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://dqkkp8tq4ep48"
path="res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_007_23228.mp3-ea80eb5acc64bf353d11a10a4adf6235.mp3str"
[deps]
source_file="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_007_23228.mp3"
dest_files=["res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_007_23228.mp3-ea80eb5acc64bf353d11a10a4adf6235.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://p2j4t2wyben8"
path="res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_008_23229.mp3-83fceb7f895afa7bd92e0cb4130cb776.mp3str"
[deps]
source_file="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_008_23229.mp3"
dest_files=["res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_008_23229.mp3-83fceb7f895afa7bd92e0cb4130cb776.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://dldkf7wdyx4j6"
path="res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_009_23230.mp3-9990345920755ff38397d326c49df385.mp3str"
[deps]
source_file="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_009_23230.mp3"
dest_files=["res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_009_23230.mp3-9990345920755ff38397d326c49df385.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://b5kykwdapbulb"
path="res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_010_23231.mp3-6ea24274e379623287ad08bc28962f4d.mp3str"
[deps]
source_file="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_010_23231.mp3"
dest_files=["res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_010_23231.mp3-6ea24274e379623287ad08bc28962f4d.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://bn86p7gojva0v"
path="res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_011_23232.mp3-e95661a406ac30091bacb02f3d971a53.mp3str"
[deps]
source_file="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_011_23232.mp3"
dest_files=["res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_011_23232.mp3-e95661a406ac30091bacb02f3d971a53.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://cmum76yuvvigi"
path="res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_012_23233.mp3-9aa6aa4e227ee657bf901b2a1e923c73.mp3str"
[deps]
source_file="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_012_23233.mp3"
dest_files=["res://.godot/imported/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_012_23233.mp3-9aa6aa4e227ee657bf901b2a1e923c73.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View File

@ -0,0 +1,77 @@
[gd_scene format=3 uid="uid://cl66unms2gim0"]
[ext_resource type="AudioStream" uid="uid://bfg31e3s4jv8c" path="res://raw_assets/sfx/Hit.mp3" id="1_uh1ab"]
[ext_resource type="AudioStream" uid="uid://b3xnffwvltdey" path="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_001_23222.mp3" id="2_cdf6c"]
[ext_resource type="AudioStream" uid="uid://c7cs50q27v680" path="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_002_23223.mp3" id="3_fxgxg"]
[ext_resource type="AudioStream" uid="uid://bn86p7gojva0v" path="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_011_23232.mp3" id="4_87wq6"]
[ext_resource type="AudioStream" uid="uid://cmum76yuvvigi" path="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_012_23233.mp3" id="5_7a25g"]
[ext_resource type="AudioStream" uid="uid://bq4xb5qcy7uif" path="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_003_23224.mp3" id="6_k2vl2"]
[ext_resource type="AudioStream" uid="uid://xj7u5c1ifip0" path="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_004_23225.mp3" id="7_x30cj"]
[ext_resource type="AudioStream" uid="uid://kvknfhu2yuty" path="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_006_23227.mp3" id="8_nb006"]
[ext_resource type="AudioStream" uid="uid://dqnaty4lxm4bd" path="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_005_23226.mp3" id="9_opble"]
[ext_resource type="AudioStream" uid="uid://dqkkp8tq4ep48" path="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_007_23228.mp3" id="10_dblfy"]
[ext_resource type="AudioStream" uid="uid://p2j4t2wyben8" path="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_008_23229.mp3" id="11_gf6kh"]
[ext_resource type="AudioStream" uid="uid://dldkf7wdyx4j6" path="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_009_23230.mp3" id="12_eqre1"]
[ext_resource type="AudioStream" uid="uid://b5kykwdapbulb" path="res://raw_assets/sfx/footsteps/zapsplat_foley_footstep_single_on_large_fallen_tree_trunk_010_23231.mp3" id="13_w4mf7"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_1cgct"]
particle_flag_align_y = true
direction = Vector3(0, 1, 0)
spread = 90.0
initial_velocity_min = 2.0
initial_velocity_max = 5.0
[sub_resource type="Curve" id="Curve_yli5f"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.08643617, 1), -3.6585922, -3.6585922, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dmbod"]
albedo_color = Color(0.44894964, 1.3055467e-06, 9.62615e-08, 1)
use_particle_trails = true
[sub_resource type="TubeTrailMesh" id="TubeTrailMesh_wwb7k"]
material = SubResource("StandardMaterial3D_dmbod")
radius = 0.1
radial_steps = 20
section_length = 0.1
section_rings = 10
curve = SubResource("Curve_yli5f")
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_uh1ab"]
random_pitch = 1.3348398
random_volume_offset_db = 10.0
streams_count = 12
stream_0/stream = ExtResource("2_cdf6c")
stream_1/stream = ExtResource("3_fxgxg")
stream_2/stream = ExtResource("6_k2vl2")
stream_3/stream = ExtResource("7_x30cj")
stream_4/stream = ExtResource("8_nb006")
stream_5/stream = ExtResource("9_opble")
stream_6/stream = ExtResource("10_dblfy")
stream_7/stream = ExtResource("11_gf6kh")
stream_8/stream = ExtResource("12_eqre1")
stream_9/stream = ExtResource("13_w4mf7")
stream_10/stream = ExtResource("4_87wq6")
stream_11/stream = ExtResource("5_7a25g")
[node name="player_effects" type="PlayerEffects" unique_id=1493455892 node_paths=PackedStringArray("splorch", "hit_sound", "walk_sound")]
splorch = NodePath("splorch")
hit_sound = NodePath("hit_sound")
walk_sound = NodePath("walk")
walk_sfx_cd = 0.5
[node name="splorch" type="GPUParticles3D" parent="." unique_id=986677517]
emitting = false
amount = 20
one_shot = true
explosiveness = 0.78
trail_enabled = true
trail_lifetime = 0.5
process_material = SubResource("ParticleProcessMaterial_1cgct")
draw_pass_1 = SubResource("TubeTrailMesh_wwb7k")
[node name="hit_sound" type="AudioStreamPlayer3D" parent="." unique_id=345049143]
stream = ExtResource("1_uh1ab")
[node name="walk" type="AudioStreamPlayer3D" parent="." unique_id=1589803505]
stream = SubResource("AudioStreamRandomizer_uh1ab")

View File

@ -1,7 +1,7 @@
[gd_scene format=3 uid="uid://ct70bpbca8one"]
[ext_resource type="PackedScene" uid="uid://bod6b3befmyt5" path="res://scenes/player/soldier_m.tscn" id="1_jd651"]
[ext_resource type="PackedScene" uid="uid://cl66unms2gim0" path="res://scenes/player/splorch.tscn" id="2_ywmwa"]
[ext_resource type="PackedScene" uid="uid://cl66unms2gim0" path="res://scenes/player/effects.tscn" id="2_ywmwa"]
[ext_resource type="PackedScene" uid="uid://n3u0jr4wiib1" path="res://scenes/ui/settings.tscn" id="3_beej8"]
[ext_resource type="PackedScene" uid="uid://2sfy0vq0fqt3" path="res://scenes/ui/player_listing.tscn" id="4_okac2"]
@ -35,7 +35,7 @@ current = true
fov = 90.0
[node name="weapon_node" type="Node3D" parent="camera_3d" unique_id=919330414]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0.09660053, -0.1177212, -0.048912734)
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0.09660053, -0.122348905, -0.048912734)
[node name="soldier_m" parent="." unique_id=281995630 instance=ExtResource("1_jd651")]
transform = Transform3D(-0.5, 0, -4.371139e-08, 0, 0.5, 0, 4.371139e-08, 0, -0.5, 0.15878421, 0, 0.19227558)

View File

@ -1,7 +1,7 @@
[gd_scene format=3 uid="uid://kfxc0migw80o"]
[ext_resource type="PackedScene" uid="uid://bod6b3befmyt5" path="res://scenes/player/soldier_m.tscn" id="1_e2ekk"]
[ext_resource type="PackedScene" uid="uid://cl66unms2gim0" path="res://scenes/player/splorch.tscn" id="2_orxjf"]
[ext_resource type="PackedScene" uid="uid://cl66unms2gim0" path="res://scenes/player/effects.tscn" id="2_orxjf"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_1cgct"]

View File

@ -1,43 +0,0 @@
[gd_scene format=3 uid="uid://cl66unms2gim0"]
[ext_resource type="AudioStream" uid="uid://bfg31e3s4jv8c" path="res://raw_assets/sfx/Hit.mp3" id="1_2hdmt"]
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_1cgct"]
particle_flag_align_y = true
direction = Vector3(0, 1, 0)
spread = 90.0
initial_velocity_min = 2.0
initial_velocity_max = 5.0
[sub_resource type="Curve" id="Curve_yli5f"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.08643617, 1), -3.6585922, -3.6585922, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dmbod"]
albedo_color = Color(0.44894964, 1.3055467e-06, 9.62615e-08, 1)
use_particle_trails = true
[sub_resource type="TubeTrailMesh" id="TubeTrailMesh_wwb7k"]
material = SubResource("StandardMaterial3D_dmbod")
radius = 0.1
radial_steps = 20
section_length = 0.1
section_rings = 10
curve = SubResource("Curve_yli5f")
[node name="player_effects" type="PlayerEffects" unique_id=1493455892 node_paths=PackedStringArray("splorch", "hit_sound")]
splorch = NodePath("splorch")
hit_sound = NodePath("hit_sound")
[node name="splorch" type="GPUParticles3D" parent="." unique_id=986677517]
emitting = false
amount = 20
one_shot = true
explosiveness = 0.78
trail_enabled = true
trail_lifetime = 0.5
process_material = SubResource("ParticleProcessMaterial_1cgct")
draw_pass_1 = SubResource("TubeTrailMesh_wwb7k")
[node name="hit_sound" type="AudioStreamPlayer3D" parent="." unique_id=345049143]
stream = ExtResource("1_2hdmt")

View File

@ -10,10 +10,23 @@ pub struct PlayerEffects {
splorch: Option<Gd<GpuParticles3D>>,
#[export]
hit_sound: Option<Gd<AudioStreamPlayer3D>>,
#[export]
walk_sound: Option<Gd<AudioStreamPlayer3D>>,
#[export]
walk_sfx_cd: f64,
walk_sfx_cd_remaining: f64,
base: Base<Node3D>,
}
#[godot_api]
impl INode3D for PlayerEffects {
fn process(&mut self, delta: f64) {
self.walk_sfx_cd_remaining -= delta;
}
}
impl PlayerEffects {
pub fn death(&mut self) {
if let Some(splorch) = &mut self.splorch {
@ -23,4 +36,14 @@ impl PlayerEffects {
sfx.play();
}
}
pub fn walk(&mut self) {
if self.walk_sfx_cd_remaining > 0. {
return;
}
if let Some(walk) = &mut self.walk_sound {
walk.play();
}
self.walk_sfx_cd_remaining = self.walk_sfx_cd;
}
}

View File

@ -218,12 +218,12 @@ pub struct LocalPlayer {
y_speed: f32,
look_up: f32,
shoot_cd: f64,
is_dead: bool,
dead_for: f64,
killer_id: Option<u16>,
time_passed: f64,
locked: bool,
base: Base<CharacterBody3D>,
@ -428,6 +428,8 @@ impl ICharacterBody3D for LocalPlayer {
}
fn process(&mut self, delta: f64) {
self.time_passed += delta;
if self.is_dead {
self.dead_for += delta;
@ -462,8 +464,6 @@ impl ICharacterBody3D for LocalPlayer {
}
}
self.shoot_cd -= delta;
let input_direction = if self.locked {
let input = Input::singleton();
@ -501,6 +501,31 @@ impl ICharacterBody3D for LocalPlayer {
if let Some(scoreboard) = &mut self.scoreboard {
scoreboard.set_visible(Input::singleton().is_action_pressed("scoreboard"));
}
if self.movement_dir.length_squared() > 0. {
if let Some(effects) = &mut self.effects {
effects.bind_mut().walk();
}
}
if let Some(weapon) = &mut self.weapon {
let (target_y, target_x) = if self.movement_dir.length_squared() > 0. {
(
(self.time_passed * 8.).sin() / 30.,
(self.time_passed * 4.).sin() / 40.,
)
} else {
(0., 0.)
};
let prev_weapon_pos = weapon.get_position();
let new_y = prev_weapon_pos.y.lerp(target_y as f32, 0.2);
let new_x = prev_weapon_pos.x.lerp(target_x as f32, 0.2);
let new_weapon_pos = Vector3 {
y: new_y,
x: new_x,
..prev_weapon_pos
};
weapon.set_position(new_weapon_pos);
}
}
fn input(&mut self, event: Gd<InputEvent>) {
@ -675,8 +700,6 @@ pub struct RemotePlayer {
is_dead: bool,
dead_for: f64,
shoot_cd: f64,
base: Base<CharacterBody3D>,
}
@ -847,8 +870,6 @@ impl ICharacterBody3D for RemotePlayer {
self.player_update(delta);
self.shoot_cd -= delta;
if let Some(mesh) = &mut self.soldier_mesh {
mesh.bind_mut()
.update_movement(Vector2::new(self.movement_dir.x, -self.movement_dir.z));
@ -859,6 +880,12 @@ impl ICharacterBody3D for RemotePlayer {
if let Some(ball_origin) = &mut self.ball_origin {
ball_origin.set_rotation(Vector3::RIGHT * self.look_up);
}
if self.movement_dir.length_squared() > 0.
&& let Some(effects) = &mut self.effects
{
effects.bind_mut().walk();
}
}
}