add sounds, add logo

This commit is contained in:
2026-04-23 18:32:57 +03:00
parent 69babae913
commit f28f21d5b4
10 changed files with 122 additions and 3 deletions
+1
View File
@@ -405,6 +405,7 @@ func _take_hit(dmg: int) -> void:
_die()
func _play_kick_blend() -> void:
SFX.kick_enemy(get_parent())
if anim_player != null and anim_player.has_animation("kick"):
anim_player.stop()
anim_player.play("kick")
+1
View File
@@ -66,3 +66,4 @@ static func _execute_recipe(a: Node3D, b: Node3D, recipe: Dictionary) -> void:
parent.add_child(result)
result.global_position = pos
FX.merge_smoke(pos + Vector3(0, 0.3, 0), parent)
SFX.merge(parent)
+1
View File
@@ -246,6 +246,7 @@ func _spawn_player() -> void:
# ─── Game flow ────────────────────────────────────────────────────────────────
func _start_game() -> void:
SFX.start_ambient(self)
game_active = true
wave = 1
score = 0
+19
View File
@@ -48,6 +48,25 @@ func _build_ui() -> void:
_build_settings_panel()
_build_difficulty_panel()
_add_studio_logo()
func _add_studio_logo() -> void:
const PATH := "res://assets/studio_logo.png"
var logo := TextureRect.new()
if ResourceLoader.exists(PATH):
logo.texture = load(PATH) as Texture2D
logo.stretch_mode = TextureRect.STRETCH_KEEP_ASPECT_CENTERED
logo.expand_mode = TextureRect.EXPAND_IGNORE_SIZE
logo.anchor_left = 1.0
logo.anchor_right = 1.0
logo.anchor_top = 1.0
logo.anchor_bottom = 1.0
logo.offset_left = -200
logo.offset_right = -16
logo.offset_top = -208
logo.offset_bottom = -16
logo.modulate.a = 0.85
add_child(logo)
func _big_btn(text: String, width: float, cb: Callable) -> Button:
var b := _btn(text, cb)
+2
View File
@@ -207,6 +207,7 @@ func _do_kick() -> void:
else:
force = 80.0
best.call("receive_kick", best_dir, force)
SFX.kick_player(get_parent())
FX.hit_spark(best.global_position + Vector3(0, 0.4, 0), get_parent())
_squish_effect()
@@ -262,6 +263,7 @@ func take_damage(amount: int, attacker_toughness: int = 0) -> void:
health = min(health - amount, max_health)
emit_signal("health_changed", health, max_health)
SFX.damage(get_parent())
_squish_effect()
func heal(amount: int) -> void:
+54
View File
@@ -0,0 +1,54 @@
class_name SFX
# Expected files in res://assets/sfx/:
# kick_player.ogg — player kicks something
# kick_enemy.ogg — enemy attacks
# merge.ogg — two objects merge
# damage.ogg — player takes damage
# ambient.ogg — looping background ambience
const _BASE := "res://assets/sfx/"
static func _play(name: String, parent: Node, volume_db: float = 0.0, pitch: float = 1.0) -> void:
var path := _BASE + name
if not ResourceLoader.exists(path):
return
var stream := load(path) as AudioStream
if stream == null:
return
var p := AudioStreamPlayer.new()
p.stream = stream
p.volume_db = volume_db
p.pitch_scale = pitch + randf_range(-0.06, 0.06)
p.bus = "Master"
parent.add_child(p)
p.play()
p.connect("finished", p.queue_free)
static func kick_player(parent: Node) -> void:
_play("kick_player.ogg", parent, -4.0)
static func kick_enemy(parent: Node) -> void:
_play("kick_enemy.ogg", parent, -6.0)
static func merge(parent: Node) -> void:
_play("merge.ogg", parent, -3.0)
static func damage(parent: Node) -> void:
_play("damage.ogg", parent, -2.0)
static func start_ambient(parent: Node) -> AudioStreamPlayer:
var path := _BASE + "ambient.ogg"
if not ResourceLoader.exists(path):
return null
var stream := load(path) as AudioStream
if stream == null:
return null
var p := AudioStreamPlayer.new()
p.stream = stream
p.volume_db = -14.0
p.bus = "Master"
p.autoplay = true
(stream as AudioStreamOggVorbis).loop = true
parent.add_child(p)
return p
+1
View File
@@ -0,0 +1 @@
uid://d2vxdhi2fmqhd