diff --git a/Audio/step1.wav b/Audio/step1.wav new file mode 100644 index 0000000..ded99be Binary files /dev/null and b/Audio/step1.wav differ diff --git a/Audio/step1.wav.import b/Audio/step1.wav.import new file mode 100644 index 0000000..d55fb38 --- /dev/null +++ b/Audio/step1.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/step1.wav-a3ca26c195a2d552516a852342ec6d84.sample" + +[deps] + +source_file="res://Audio/step1.wav" +dest_files=[ "res://.import/step1.wav-a3ca26c195a2d552516a852342ec6d84.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/Audio/step2.wav b/Audio/step2.wav new file mode 100644 index 0000000..6c0d5ed Binary files /dev/null and b/Audio/step2.wav differ diff --git a/Audio/step2.wav.import b/Audio/step2.wav.import new file mode 100644 index 0000000..c623a33 --- /dev/null +++ b/Audio/step2.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/step2.wav-e176ee775e84a4b66608c0aea784cdeb.sample" + +[deps] + +source_file="res://Audio/step2.wav" +dest_files=[ "res://.import/step2.wav-e176ee775e84a4b66608c0aea784cdeb.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/Audio/step3.wav b/Audio/step3.wav new file mode 100644 index 0000000..c716122 Binary files /dev/null and b/Audio/step3.wav differ diff --git a/Audio/step3.wav.import b/Audio/step3.wav.import new file mode 100644 index 0000000..241df79 --- /dev/null +++ b/Audio/step3.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/step3.wav-1afbc8d210aab2d152de0a352b4cda99.sample" + +[deps] + +source_file="res://Audio/step3.wav" +dest_files=[ "res://.import/step3.wav-1afbc8d210aab2d152de0a352b4cda99.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/Audio/step4.wav b/Audio/step4.wav new file mode 100644 index 0000000..1eb913f Binary files /dev/null and b/Audio/step4.wav differ diff --git a/Audio/step4.wav.import b/Audio/step4.wav.import new file mode 100644 index 0000000..d7a6b6a --- /dev/null +++ b/Audio/step4.wav.import @@ -0,0 +1,23 @@ +[remap] + +importer="wav" +type="AudioStreamSample" +path="res://.import/step4.wav-defe51a16708ba89110de718eb9ed751.sample" + +[deps] + +source_file="res://Audio/step4.wav" +dest_files=[ "res://.import/step4.wav-defe51a16708ba89110de718eb9ed751.sample" ] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/Audio/walk-home-steps-sound_99bpm_B_minor.wav.reapeaks b/Audio/walk-home-steps-sound_99bpm_B_minor.wav.reapeaks new file mode 100644 index 0000000..c0cfceb Binary files /dev/null and b/Audio/walk-home-steps-sound_99bpm_B_minor.wav.reapeaks differ diff --git a/AudioSteps.gd b/AudioSteps.gd new file mode 100644 index 0000000..8bb60a2 --- /dev/null +++ b/AudioSteps.gd @@ -0,0 +1,26 @@ +extends AudioStreamPlayer3D + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" +var array = [ 21019, 54299, 81449, 107722, 133996, 158518 ] +var currStep = 0 +var rng = RandomNumberGenerator.new() + +# Called when the node enters the scene tree for the first time. +func _ready(): + rng.randomize() + + +func PlayStep(): + #self.stop() + #currStep = rng.randi_range(0,4) + #self.seek(currStep) + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + #if (self.get_playback_position() >= currStep + 1): + # self.stop() + pass diff --git a/Player.gd b/Player.gd index f396c08..208eacc 100644 --- a/Player.gd +++ b/Player.gd @@ -10,7 +10,9 @@ export var jump = 30 export var slapkill = 0.8 var slap = 0.0 var chargeSlap = false -var isSlap = false; +var isSlap = false +var isStep = false +var stepAcc = 0 export var mouse_sensitivity = 0.03 @@ -29,8 +31,11 @@ onready var slap_animator = $HandMovement onready var Menu = $HUD/Start onready var AudioSlap = $AudioSlap onready var AudioMegaSlap = $AudioMegaSlap +onready var Steps = [ $Step1, $Step2, $Step3, $Step4 ] +var rng = RandomNumberGenerator.new() func _ready(): + rng.randomize() slap_animator.current_animation = "basic_slap" @@ -61,12 +66,15 @@ func _physics_process(delta): elif is_on_floor() and full_contact: gravity_vec = -get_floor_normal() * gravity h_acceleration = normal_acceleration + isStep = true else: gravity_vec = -get_floor_normal() h_acceleration = normal_acceleration + if Input.is_action_just_pressed("jump") and (is_on_floor() or ground_check.is_colliding()): gravity_vec = Vector3.UP * jump + isStep = false if Input.is_action_pressed("move_forward"): direction -= transform.basis.z @@ -77,6 +85,7 @@ func _physics_process(delta): elif Input.is_action_pressed("move_right"): direction += transform.basis.x + # Slappening if Input.is_action_pressed("slap"): if slap < 0.01: @@ -104,9 +113,19 @@ func _physics_process(delta): slap_animator.seek(slap, true) slap_gauge.fill = slap; slap_gauge.kill = slapkill; - + direction = direction.normalized() + + if isStep: + stepAcc += (abs(direction.x) + abs(direction.z)) * delta + else: + stepAcc = 0.0 + + if (stepAcc > 0.3): + stepAcc -= 0.45 + Steps[rng.randi_range(0,3)].play(); + h_velocity = h_velocity.linear_interpolate(direction * speed, h_acceleration * delta) movement.z = h_velocity.z + gravity_vec.z movement.x = h_velocity.x + gravity_vec.x diff --git a/Player.tscn b/Player.tscn index 6cf0138..dee9881 100644 --- a/Player.tscn +++ b/Player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=12 format=2] +[gd_scene load_steps=16 format=2] [ext_resource path="res://Player.gd" type="Script" id=1] [ext_resource path="res://BlenderStuff/Hand/protohand.obj" type="ArrayMesh" id=2] @@ -6,6 +6,10 @@ [ext_resource path="res://HUD.tscn" type="PackedScene" id=4] [ext_resource path="res://Audio/80-s-clap.wav" type="AudioStream" id=5] [ext_resource path="res://Audio/MegaSlap.wav" type="AudioStream" id=6] +[ext_resource path="res://Audio/step2.wav" type="AudioStream" id=8] +[ext_resource path="res://Audio/step3.wav" type="AudioStream" id=9] +[ext_resource path="res://Audio/step4.wav" type="AudioStream" id=10] +[ext_resource path="res://Audio/step1.wav" type="AudioStream" id=11] [sub_resource type="CapsuleShape" id=2] height = 3.0 @@ -13,7 +17,6 @@ height = 3.0 [sub_resource type="CylinderShape" id=3] [sub_resource type="SpatialMaterial" id=4] -flags_no_depth_test = true albedo_texture = ExtResource( 3 ) uv1_triplanar = true @@ -133,6 +136,17 @@ emission_angle_enabled = true doppler_tracking = 2 [node name="Music" type="AudioStreamPlayer" parent="."] -volume_db = 13.983 autoplay = true bus = "Music" + +[node name="Step2" type="AudioStreamPlayer3D" parent="."] +stream = ExtResource( 8 ) + +[node name="Step3" type="AudioStreamPlayer3D" parent="."] +stream = ExtResource( 9 ) + +[node name="Step1" type="AudioStreamPlayer3D" parent="."] +stream = ExtResource( 11 ) + +[node name="Step4" type="AudioStreamPlayer3D" parent="."] +stream = ExtResource( 10 ) diff --git a/Steps.gd b/Steps.gd new file mode 100644 index 0000000..ea28a79 --- /dev/null +++ b/Steps.gd @@ -0,0 +1,16 @@ +extends Control + + +# Declare member variables here. Examples: +# var a = 2 +# var b = "text" +onready var Steps = [ $Step1, $Step2, $Step3, $Step4 ] +var rng = RandomNumberGenerator.new() + +# Called when the node enters the scene tree for the first time. +func _ready(): + rng.randomize() + +func playStep(): + Steps[rng.randi_range(0,3)].play(); + diff --git a/default_bus_layout.tres b/default_bus_layout.tres index a915b94..108d1a3 100644 --- a/default_bus_layout.tres +++ b/default_bus_layout.tres @@ -1,6 +1,13 @@ -[gd_resource type="AudioBusLayout" format=2] +[gd_resource type="AudioBusLayout" load_steps=2 format=2] + +[sub_resource type="AudioEffectCompressor" id=1] +resource_name = "Compressor" +threshold = -10.6 +gain = 4.4 [resource] +bus/0/effect/0/effect = SubResource( 1 ) +bus/0/effect/0/enabled = true bus/1/name = "SFX" bus/1/solo = false bus/1/mute = false diff --git a/project.godot b/project.godot index 2648ef6..ef76378 100644 --- a/project.godot +++ b/project.godot @@ -18,6 +18,7 @@ config/icon="res://icon.png" window/size/width=1920 window/size/height=1080 +window/size/fullscreen=true window/size/test_width=1280 window/size/test_height=720 window/stretch/mode="viewport"