Added minelayer shot and tick sounds

This commit is contained in:
2026-01-05 15:53:01 +03:00
parent 6f76be3c21
commit 4a4cf3f299
12 changed files with 106 additions and 3 deletions
@@ -9,7 +9,7 @@ enum SpriteState {
}
const OFF_TIMES = [
const OFF_TIMES : Array[float] = [
1.0, 1.0, 0.5, 0.25, 0.05, 0.05, 0.05, 0.05, 0.05,
]
const ON_TIME = 0.05
@@ -74,8 +74,13 @@ func _on_sprite_on_timer_timeout() -> void:
_try_to_damage_by_blast()
_process_hit_for_projectile(null)
else:
var delay_time := OFF_TIMES[_current_off_time_index]
var stream : AudioStream = SoundManager.sfx_weapon_minelayer_tick_low if delay_time > 0.1 \
else SoundManager.sfx_weapon_minelayer_tick_high
SoundManager.play_sfx_stream(stream, global_position)
_current_sprite_state = SpriteState.OFF
sprite_off_timer.start(OFF_TIMES[_current_off_time_index])
sprite_off_timer.start(delay_time)
func _on_sprite_off_timer_timeout() -> void:
@@ -12,6 +12,7 @@ func shoot(ship_velocity: Vector2) -> bool:
var is_shot := super.shoot(ship_velocity)
if is_shot:
_can_shoot = false
SoundManager.play_sfx_stream(SoundManager.sfx_weapon_minelayer_shot, global_position)
sprite.play(SHOT_ANIMATION)
return is_shot
@@ -74,3 +74,6 @@ projectile_scene = ExtResource("3_nkog1")
[node name="AnimatedSprite2D" parent="." index="0"]
sprite_frames = SubResource("SpriteFrames_nkog1")
animation = &"shot"
[node name="Muzzle" parent="." index="1"]
position = Vector2(-9, 0)
@@ -72,5 +72,9 @@ script = ExtResource("2_mvhh7")
projectile_scene = ExtResource("3_u0als")
[node name="AnimatedSprite2D" parent="." index="0"]
position = Vector2(2, 0)
sprite_frames = SubResource("SpriteFrames_u0als")
animation = &"shot"
[node name="Muzzle" parent="." index="1"]
position = Vector2(9, 0)