Added more shot sounds. Minor fixes
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -30,7 +30,8 @@ func _physics_process(delta: float) -> void:
|
||||
_current_progress += delta
|
||||
_update_progress_indicator()
|
||||
if _current_progress >= passage_data.length:
|
||||
completed.emit()
|
||||
if enemy_swamp_controller.get_enemy_count() == 0:
|
||||
completed.emit()
|
||||
|
||||
|
||||
func _set_passage_data(new_data: PassageData) -> void:
|
||||
|
||||
@@ -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] = []
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user