Implemented most sounds (Missing Boss and Hero Laught))

This commit is contained in:
Jan Schuffenhauer
2020-04-20 23:20:30 +02:00
parent 1299860e1f
commit 723b765b3e
45 changed files with 466 additions and 2 deletions

View File

@@ -699,7 +699,7 @@ shape = SubResource( 47 )
[node name="Pivot" type="Position2D" parent="."]
position = Vector2( 0, -4 )
rotation = 3.14159
rotation = 1.5708
__meta__ = {
"_gizmo_extents_": 20.0
}
@@ -756,6 +756,7 @@ script = ExtResource( 14 )
[node name="Roll" type="Node" parent="AnimationStates"]
script = ExtResource( 16 )
SoundLibary = PoolStringArray( "res://Player/Sounds/roll4.wav", "res://Player/Sounds/roll5.wav", "res://Player/Sounds/roll6.wav" )
[node name="Effects" type="Node2D" parent="."]

BIN
src/Player/Sounds/roll4.wav Normal file

Binary file not shown.

View File

@@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/roll4.wav-113597ca7b30182e560c90a8eb271750.sample"
[deps]
source_file="res://Player/Sounds/roll4.wav"
dest_files=[ "res://.import/roll4.wav-113597ca7b30182e560c90a8eb271750.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=false
compress/mode=0

BIN
src/Player/Sounds/roll5.wav Normal file

Binary file not shown.

View File

@@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/roll5.wav-ac043f34bae365968703b73bd62916d9.sample"
[deps]
source_file="res://Player/Sounds/roll5.wav"
dest_files=[ "res://.import/roll5.wav-ac043f34bae365968703b73bd62916d9.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=false
compress/mode=0

BIN
src/Player/Sounds/roll6.wav Normal file

Binary file not shown.

View File

@@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/roll6.wav-1aa8acb680444b32fcc834ed35ef914e.sample"
[deps]
source_file="res://Player/Sounds/roll6.wav"
dest_files=[ "res://.import/roll6.wav-1aa8acb680444b32fcc834ed35ef914e.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=false
compress/mode=0

View File

@@ -1,8 +1,44 @@
extends "res://Player/States/PlayerAnimationState.gd"
#the channel on which the sound is played
const CHANNEL = 1
#one sound will be chosen at random
export var SoundLibary :PoolStringArray=[]
#the delay between 2 sounds being played, a new sound will only start if the old one is finished
export(float,0,5) var Delay = 0.2
var is_playing_sound:bool =false
var delay_passed:bool=true
var timer:Timer
func _ready():
timer=Timer.new()
self.add_child(timer)
timer.connect("timeout",self,"sig_timer_timeout")
SoundControler._effect[CHANNEL].connect("finished", self, "sig_walk_sound_finished")
func enter():
animation_playback.travel("roll")
func update(delta):
var input_vector = get_input_direction()
animation_tree.set("parameters/roll/blend_position", owner.rollvector)
_play_random_sound()
func _play_random_sound():
if delay_passed and is_playing_sound==false:
var sound = SoundLibary[rand_range(0,SoundLibary.size())]
SoundControler.pub_play_effect(sound,CHANNEL)
is_playing_sound = true
delay_passed=false
#timer.start(Delay)
func sig_timer_timeout ():
delay_passed=true
func sig_walk_sound_finished():
is_playing_sound = false
timer.start(Delay)