add sounds, add logo
This commit is contained in:
@@ -3,15 +3,15 @@
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://baeea1yfs0cnn"
|
||||
path="res://.godot/imported/Tutorial_Shield.jpeg-6b96e6b9716aced42153397e827ce868.ctex"
|
||||
path="res://.godot/imported/Tutorial_shield.jpeg-d9b563c9ca34dc1a19e82a0ec964c1b9.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/Tutorial_Shield.jpeg"
|
||||
dest_files=["res://.godot/imported/Tutorial_Shield.jpeg-6b96e6b9716aced42153397e827ce868.ctex"]
|
||||
source_file="res://assets/Tutorial_shield.jpeg"
|
||||
dest_files=["res://.godot/imported/Tutorial_shield.jpeg-d9b563c9ca34dc1a19e82a0ec964c1b9.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.9 MiB |
@@ -0,0 +1,40 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://baavv8uqo25la"
|
||||
path="res://.godot/imported/studio_logo.png-f3d319855b8a77cbfc974454f8f0d5d5.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/studio_logo.png"
|
||||
dest_files=["res://.godot/imported/studio_logo.png-f3d319855b8a77cbfc974454f8f0d5d5.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/uastc_level=0
|
||||
compress/rdo_quality_loss=0.0
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/channel_remap/red=0
|
||||
process/channel_remap/green=1
|
||||
process/channel_remap/blue=2
|
||||
process/channel_remap/alpha=3
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
@@ -0,0 +1 @@
|
||||
uid://d2vxdhi2fmqhd
|
||||
Reference in New Issue
Block a user