Added more shot sounds. Minor fixes

This commit is contained in:
2026-01-04 20:24:19 +03:00
parent 5bd04f131e
commit 6f76be3c21
18 changed files with 157 additions and 18 deletions
+21 -8
View File
@@ -15,6 +15,9 @@ const MAX_POSITION = Vector2(600, 330)
@export var passage : Passage
var _enemy_count := 0
@onready var enemy_update_timer : Timer = $EnemyUpdateTimer
@@ -28,17 +31,13 @@ func create_enemy(enemy_data: EnemyData) -> void:
enemy.position = enemy_data.spawn_point
enemy.enemy_data = enemy_data
enemy.velocity = enemy.position.direction_to(player.position) * enemy.max_speed
enemy.destroyed.connect(_on_enemy_destroyed, CONNECT_ONE_SHOT)
_update_enemy.call_deferred(enemy)
_enemy_count += 1
func _on_enemy_update_timer_timeout() -> void:
var enemies := get_tree().get_nodes_in_group("enemies")
if enemies.is_empty(): return
var enemy : Node = enemies.pick_random()
if not enemy is AbstractEnemyShip: return
_update_enemy(enemy)
func get_enemy_count() -> int:
return _enemy_count
func _update_enemy(enemy: AbstractEnemyShip) -> void:
@@ -97,3 +96,17 @@ func _get_random_player() -> PlayerShip:
var player : PlayerShip = players.pick_random()
return player
func _on_enemy_destroyed() -> void:
_enemy_count -= 1
func _on_enemy_update_timer_timeout() -> void:
var enemies := get_tree().get_nodes_in_group("enemies")
if enemies.is_empty(): return
var enemy : Node = enemies.pick_random()
if not enemy is AbstractEnemyShip: return
_update_enemy(enemy)
@@ -17,8 +17,9 @@ func _ready() -> void:
func shoot(ship_velocity: Vector2) -> bool:
var is_shot := super.shoot(ship_velocity)
if is_shot:
sprite.play(SHOT_ANIMATION)
_can_shoot = false
SoundManager.play_sfx_stream(SoundManager.sfx_weapon_cannon_shot, global_position)
sprite.play(SHOT_ANIMATION)
cooldown_timer.start()
front_particles.restart()
left_particles.restart()
@@ -12,8 +12,9 @@ func _ready() -> void:
func shoot(ship_velocity: Vector2) -> bool:
var is_shot := super.shoot(ship_velocity)
if is_shot:
sprite.play(SHOT_ANIMATION)
_can_shoot = false
SoundManager.play_sfx_stream(SoundManager.sfx_weapon_plasma_shot, global_position)
sprite.play(SHOT_ANIMATION)
cooldown_timer.start()
return is_shot
@@ -57,8 +57,9 @@ script = ExtResource("2_hxkfe")
projectile_scene = ExtResource("3_hxkfe")
[node name="AnimatedSprite2D" parent="." index="0"]
position = Vector2(7, 0)
sprite_frames = SubResource("SpriteFrames_hxkfe")
animation = &"shot"
animation = &"reloading"
[node name="Muzzle" parent="." index="2"]
position = Vector2(1, 2)
position = Vector2(8, 2)
@@ -12,8 +12,9 @@ func _ready() -> void:
func shoot(ship_velocity: Vector2) -> bool:
var is_shot := super.shoot(ship_velocity)
if is_shot:
sprite.play(SHOT_ANIMATION)
_can_shoot = false
SoundManager.play_sfx_stream(SoundManager.sfx_weapon_railgun_shot, global_position)
sprite.play(SHOT_ANIMATION)
return is_shot
@@ -15,8 +15,9 @@ func _ready() -> void:
func shoot(ship_velocity: Vector2) -> bool:
var is_shot := super.shoot(ship_velocity)
if is_shot:
sprite.play(SHOT_ANIMATION)
_can_shoot = false
SoundManager.play_sfx_stream(SoundManager.sfx_weapon_sharapnel_shot, global_position)
sprite.play(SHOT_ANIMATION)
cooldown_timer.start()
shot_particles.restart()
shell_particles.emit_particle(Transform2D(), Vector2(), Color(), Color(), 0)
+1
View File
@@ -30,6 +30,7 @@ func _physics_process(delta: float) -> void:
_current_progress += delta
_update_progress_indicator()
if _current_progress >= passage_data.length:
if enemy_swamp_controller.get_enemy_count() == 0:
completed.emit()
+4
View File
@@ -27,6 +27,10 @@ const MUSIC_BUS = "Music"
@export_group("SFX Sounds", "sfx")
@export_subgroup("Weapon", "sfx_weapon")
@export var sfx_weapon_gatling_shot : AudioStream
@export var sfx_weapon_cannon_shot : AudioStream
@export var sfx_weapon_plasma_shot : AudioStream
@export var sfx_weapon_railgun_shot : AudioStream
@export var sfx_weapon_sharapnel_shot : AudioStream
var _ui_players : Array[AudioStreamPlayer] = []
+9 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://bc0np3ldfspq4"]
[gd_scene load_steps=11 format=3 uid="uid://bc0np3ldfspq4"]
[ext_resource type="Script" uid="uid://cx5qcukr66whc" path="res://game/managers/sound_manager.gd" id="1_cg0sy"]
[ext_resource type="AudioStream" uid="uid://bqcqigmj23ub5" path="res://sound/ui/ui_accept.wav" id="2_agyxs"]
@@ -6,6 +6,10 @@
[ext_resource type="AudioStream" uid="uid://bmlticluh8uqd" path="res://sound/ui/ui_next.wav" id="4_fpnh3"]
[ext_resource type="AudioStream" uid="uid://bm1qd04yh32i8" path="res://sound/ui/ui_previous.wav" id="5_22ptj"]
[ext_resource type="AudioStream" uid="uid://vbk40x6ifoyv" path="res://sound/sfx/weapon/gatling_shot.wav" id="6_0i6kl"]
[ext_resource type="AudioStream" uid="uid://sritblmebes1" path="res://sound/sfx/weapon/cannon_shot.wav" id="7_fpnh3"]
[ext_resource type="AudioStream" uid="uid://b4l3ksw7gh8u0" path="res://sound/sfx/weapon/plasma_shot.wav" id="8_6ll5c"]
[ext_resource type="AudioStream" uid="uid://bqo2n7jytda3r" path="res://sound/sfx/weapon/shrapnel_shot.wav" id="8_22ptj"]
[ext_resource type="AudioStream" uid="uid://cflrm2y3yp371" path="res://sound/sfx/weapon/railgun_shot.wav" id="8_ab171"]
[node name="SoundManager" type="Node"]
script = ExtResource("1_cg0sy")
@@ -20,3 +24,7 @@ ui_stream_decline = ExtResource("3_0i6kl")
ui_stream_next = ExtResource("4_fpnh3")
ui_stream_previous = ExtResource("5_22ptj")
sfx_weapon_gatling_shot = ExtResource("6_0i6kl")
sfx_weapon_cannon_shot = ExtResource("7_fpnh3")
sfx_weapon_plasma_shot = ExtResource("8_6ll5c")
sfx_weapon_railgun_shot = ExtResource("8_ab171")
sfx_weapon_sharapnel_shot = ExtResource("8_22ptj")
Binary file not shown.
+24
View File
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://sritblmebes1"
path="res://.godot/imported/cannon_shot.wav-c7bcdeb19abdda67666e9038cc65f8e0.sample"
[deps]
source_file="res://sound/sfx/weapon/cannon_shot.wav"
dest_files=["res://.godot/imported/cannon_shot.wav-c7bcdeb19abdda67666e9038cc65f8e0.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=2
Binary file not shown.
Binary file not shown.
+24
View File
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://b4l3ksw7gh8u0"
path="res://.godot/imported/plasma_shot.wav-fe7a6ee9f275f4b069e448b5e0578c62.sample"
[deps]
source_file="res://sound/sfx/weapon/plasma_shot.wav"
dest_files=["res://.godot/imported/plasma_shot.wav-fe7a6ee9f275f4b069e448b5e0578c62.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=2
Binary file not shown.
+24
View File
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cflrm2y3yp371"
path="res://.godot/imported/railgun_shot.wav-37f3af63c2f54f3e3d9c14d736e4f542.sample"
[deps]
source_file="res://sound/sfx/weapon/railgun_shot.wav"
dest_files=["res://.godot/imported/railgun_shot.wav-37f3af63c2f54f3e3d9c14d736e4f542.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=2
Binary file not shown.
+24
View File
@@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bqo2n7jytda3r"
path="res://.godot/imported/shrapnel_shot.wav-947cd08a876f013d81106ab310e8ad03.sample"
[deps]
source_file="res://sound/sfx/weapon/shrapnel_shot.wav"
dest_files=["res://.godot/imported/shrapnel_shot.wav-947cd08a876f013d81106ab310e8ad03.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=2