The sounds, they are working!

This commit is contained in:
MarcEricMartel 2022-10-12 09:10:44 -04:00
parent 449479791c
commit 168128f8a8
7 changed files with 65 additions and 31 deletions

BIN
Audio/whoosh.wav Normal file

Binary file not shown.

23
Audio/whoosh.wav.import Normal file
View File

@ -0,0 +1,23 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/whoosh.wav-3f78e56f3c095630fbe6defec4c28484.sample"
[deps]
source_file="res://Audio/whoosh.wav"
dest_files=[ "res://.import/whoosh.wav-3f78e56f3c095630fbe6defec4c28484.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

View File

@ -32,11 +32,10 @@ onready var ground_check = $GroundCheck
onready var slap_gauge = $HUD/PlayerLayer/ActualHUD/SlapGauge
onready var slap_animator = $HandMovement
onready var Menu = $HUD/MenuLayer/Start
onready var AudioSlap = $AudioSlap
onready var AudioMegaSlap = $AudioMegaSlap
onready var hitbox = $Head/Camera/HitBox
onready var slap_cooldown = $SlapCooldown
onready var AudioCharge = $AudioCharge
onready var Whoosh = $AudioWhoosh
onready var Music = $Music
onready var Steps = [ $Step1, $Step2, $Step3, $Step4 ]
var rng = RandomNumberGenerator.new()
@ -108,8 +107,9 @@ func _physics_process(delta):
chargeSlap = true;
elif Input.is_action_just_released("slap"):
if chargeSlap:
isSlap = true;
chargeSlap = false;
isSlap = true
Whoosh.play()
chargeSlap = false
can_slap = false
slap_cooldown.start(0.25)
AudioCharge.stop();
@ -131,16 +131,11 @@ func _physics_process(delta):
slap_gauge.kill = slapkill;
if isSlap:
if slap >= slapkill:
AudioMegaSlap.play()
else:
AudioSlap.play()
isSlap = false;
isSlap = false;
hitbox.monitorable = true
hitbox.slap_level = slap
hitbox.slap_kill = slapkill
hitbox.slap_vector = point_to.get_global_transform().origin - camera.get_global_transform().origin
direction = direction.normalized()
if isStep:

View File

@ -1,11 +1,10 @@
[gd_scene load_steps=21 format=2]
[gd_scene load_steps=20 format=2]
[ext_resource path="res://Player.gd" type="Script" id=1]
[ext_resource path="res://BlenderStuff/Hand/protohand.obj" type="ArrayMesh" id=2]
[ext_resource path="res://Textures/kenney_prototype_textures/purple/texture_01.png" type="Texture" id=3]
[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/whoosh.wav" type="AudioStream" id=5]
[ext_resource path="res://Scripts/HitBox.gd" type="Script" id=7]
[ext_resource path="res://Audio/step2.wav" type="AudioStream" id=8]
[ext_resource path="res://Audio/step3.wav" type="AudioStream" id=9]
@ -148,23 +147,6 @@ cast_to = Vector3( 0, -1.5, 0 )
anims/RESET = SubResource( 5 )
anims/basic_slap = SubResource( 6 )
[node name="AudioSlap" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource( 5 )
attenuation_model = 2
unit_db = 80.0
max_db = 6.0
bus = "SFX"
[node name="AudioMegaSlap" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource( 6 )
attenuation_model = 2
unit_db = 60.0
max_db = 4.0
pitch_scale = 2.0
bus = "SFX"
emission_angle_enabled = true
doppler_tracking = 2
[node name="Music" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 13 )
volume_db = -3.0
@ -216,4 +198,9 @@ pitch_scale = 0.79
bus = "SFX"
doppler_tracking = 2
[node name="AudioWhoosh" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 5 )
volume_db = -9.613
pitch_scale = 8.0
[connection signal="timeout" from="SlapCooldown" to="." method="_on_SlapCooldown_timeout"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=16 format=2]
[gd_scene load_steps=18 format=2]
[ext_resource path="res://Scripts/HitBox.gd" type="Script" id=1]
[ext_resource path="res://Scenes/Enemy.gd" type="Script" id=2]
@ -7,6 +7,8 @@
[ext_resource path="res://Textures/MetalCorrodedHeavy001/MetalCorrodedHeavy001_Flat.jpg" type="Texture" id=5]
[ext_resource path="res://Textures/MetalCorrodedHeavy001/MetalCorrodedHeavy001_NRM_1K_METALNESS.jpg" type="Texture" id=6]
[ext_resource path="res://Audio/boom.wav" type="AudioStream" id=7]
[ext_resource path="res://Audio/80-s-clap.wav" type="AudioStream" id=8]
[ext_resource path="res://Audio/MegaSlap.wav" type="AudioStream" id=9]
[sub_resource type="SphereMesh" id=6]
@ -69,6 +71,25 @@ script = ExtResource( 3 )
[node name="HeadCollision" type="CollisionShape" parent="Hurtbox"]
shape = SubResource( 7 )
[node name="AudioSlap" type="AudioStreamPlayer3D" parent="Hurtbox"]
transform = Transform( 0.491077, 0, 0, 0, 0.491077, 0, 0, 0, 0.491077, 0, 0, 0 )
stream = ExtResource( 8 )
attenuation_model = 2
unit_db = 80.0
max_db = 6.0
bus = "SFX"
[node name="AudioMegaSlap" type="AudioStreamPlayer3D" parent="Hurtbox"]
transform = Transform( 0.491077, 0, 0, 0, 0.491077, 0, 0, 0, 0.491077, 0, 0, 0 )
stream = ExtResource( 9 )
attenuation_model = 2
unit_db = 60.0
max_db = 4.0
pitch_scale = 2.0
bus = "SFX"
emission_angle_enabled = true
doppler_tracking = 2
[node name="EnemyCollision" type="CollisionShape" parent="."]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.094023, 0 )
shape = SubResource( 8 )

View File

@ -1,6 +1,9 @@
class_name HurtBox
extends Area
onready var Slap = $AudioSlap
onready var MegaSlap = $AudioMegaSlap
func _init():
collision_layer = 0
collision_mask = 2
@ -14,7 +17,12 @@ func _on_area_entered(hitbox: HitBox):
if hitbox.hitbox_type == hitbox.HitboxType.Unassigned:
return
if hitbox.hitbox_type == hitbox.HitboxType.Slap and owner.has_method("get_slapped"):
owner.get_slapped(hitbox.slap_level,hitbox.slap_kill, hitbox.slap_vector)
if hitbox.slap_level >= hitbox.slap_kill:
MegaSlap.play()
else:
Slap.play()
elif hitbox.hitbox_type == hitbox.HitboxType.Projectile and owner.has_method("get_shot"):
owner.get_shot(hitbox.owner)