Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions assets/first_party/sounds/throwing_enemy/attackSound.wav
Git LFS file not shown
24 changes: 24 additions & 0 deletions assets/first_party/sounds/throwing_enemy/attackSound.wav.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[remap]

importer="wav"
type="AudioStreamWAV"
uid="uid://c5nln8i3amtlt"
path="res://.godot/imported/attackSound.wav-5330013a6325690f9475e4388885002d.sample"

[deps]

source_file="res://assets/first_party/sounds/throwing_enemy/attackSound.wav"
dest_files=["res://.godot/imported/attackSound.wav-5330013a6325690f9475e4388885002d.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=2
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[ext_resource type="Script" uid="uid://cx0sk4uhvnii0" path="res://scenes/game_logic/walk_behaviors/erratic_walk_behavior.gd" id="3_xxd2s"]
[ext_resource type="Script" uid="uid://csev4hv57utxv" path="res://scenes/game_logic/walk_behaviors/character_speeds.gd" id="4_xxd2s"]
[ext_resource type="Texture2D" uid="uid://c75ofhy3swhj3" path="res://scenes/game_elements/characters/enemies/guard/components/exclamation_mark.png" id="7_8q7cb"]
[ext_resource type="AudioStream" uid="uid://c5nln8i3amtlt" path="res://assets/first_party/sounds/throwing_enemy/attackSound.wav" id="8_e2qj4"]

[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_0607a"]

Expand Down Expand Up @@ -151,6 +152,12 @@ volume_db = -2.0
max_distance = 500.0
bus = &"SFX"

[node name="AttackSound" type="AudioStreamPlayer2D" parent="Sounds" unique_id=441928978]
unique_name_in_owner = true
stream = ExtResource("8_e2qj4")
volume_db = 5.0
bus = &"SFX"

[connection signal="animation_finished" from="AnimatedSprite2D" to="." method="_on_animated_sprite_animation_finished"]
[connection signal="timeout" from="BehaviorTimer" to="." method="_on_BehaviorTimer_timeout"]
[connection signal="body_entered" from="AttackRadius" to="." method="_on_attack_radius_body_entered"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const MAX_SPEED: float = 300
## Sound played when entering DETECTING or ALERTED states.
@export var alert_sound_stream: AudioStream:
set = _set_alert_sound_stream
## Sound played when entering ATTACKING state.
@export var attack_sound_stream: AudioStream

var state: State = State.IDLE:
set = _set_state
Expand All @@ -61,6 +63,7 @@ var _previous_non_detecting_state: State = State.IDLE
@onready var animated_sprite: AnimatedSprite2D = %AnimatedSprite2D
@onready var char_sprite_behavior: CharacterSpriteBehavior = %CharacterSpriteBehavior
@onready var _alert_sound: AudioStreamPlayer = %AlertSound
@onready var _attack_sound: AudioStreamPlayer2D = %AttackSound


func _ready() -> void:
Expand All @@ -72,7 +75,6 @@ func _ready() -> void:
awareness_bar.visible = false
_set_alert_sound_stream(alert_sound_stream)
_initial_position = global_position

state = State.IDLE


Expand Down Expand Up @@ -264,6 +266,8 @@ func _set_state(new_state: State) -> void:
State.ALERTED:
if not _alert_sound.playing:
_alert_sound.play()
if not _attack_sound.playing:
_attack_sound.play()
awareness_bar.value = awareness_bar.max_value
awareness_bar.tint_progress = Color.RED
awareness_bar.modulate.a = 1.0
Expand Down