Skip to content

Commit

Permalink
feat: add background music by Abstraction
Browse files Browse the repository at this point in the history
  • Loading branch information
phibkro committed Jul 23, 2024
1 parent 5c42c97 commit 52e8708
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 11 deletions.
Binary file added assets/Three Red Hearts - Box Jump.ogg
Binary file not shown.
19 changes: 19 additions & 0 deletions assets/Three Red Hearts - Box Jump.ogg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[remap]

importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://r5qlf4177kcm"
path="res://.godot/imported/Three Red Hearts - Box Jump.ogg-4145b5124c4cbba032ab1c5f18682143.oggvorbisstr"

[deps]

source_file="res://assets/Three Red Hearts - Box Jump.ogg"
dest_files=["res://.godot/imported/Three Red Hearts - Box Jump.ogg-4145b5124c4cbba032ab1c5f18682143.oggvorbisstr"]

[params]

loop=true
loop_offset=0.0
bpm=0.0
beat_count=0
bar_beats=4
File renamed without changes.
6 changes: 3 additions & 3 deletions assets/confirm.wav.import → assets/sfx/confirm.wav.import
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
importer="wav"
type="AudioStreamWAV"
uid="uid://c86lhi4x3wuyb"
path="res://.godot/imported/confirm.wav-44b9323484d1ff24c35ee234bc7096b7.sample"
path="res://.godot/imported/confirm.wav-77a79ad665f7e91913278e1f1b315796.sample"

[deps]

source_file="res://assets/confirm.wav"
dest_files=["res://.godot/imported/confirm.wav-44b9323484d1ff24c35ee234bc7096b7.sample"]
source_file="res://assets/sfx/confirm.wav"
dest_files=["res://.godot/imported/confirm.wav-77a79ad665f7e91913278e1f1b315796.sample"]

[params]

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
importer="wav"
type="AudioStreamWAV"
uid="uid://03udbys7cv0p"
path="res://.godot/imported/explosion.wav-de00f2d0ef23a85998326fdf0ffd33ab.sample"
path="res://.godot/imported/explosion.wav-e1f35b1a1dc4bf25a23a1f22f1673be5.sample"

[deps]

source_file="res://assets/explosion.wav"
dest_files=["res://.godot/imported/explosion.wav-de00f2d0ef23a85998326fdf0ffd33ab.sample"]
source_file="res://assets/sfx/explosion.wav"
dest_files=["res://.godot/imported/explosion.wav-e1f35b1a1dc4bf25a23a1f22f1673be5.sample"]

[params]

Expand Down
2 changes: 1 addition & 1 deletion src/hud.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[ext_resource type="FontFile" uid="uid://d36ycqtk4abh6" path="res://assets/silver.ttf" id="1_2dp2q"]
[ext_resource type="Script" path="res://src/hud.gd" id="1_8fgn7"]
[ext_resource type="AudioStream" uid="uid://c86lhi4x3wuyb" path="res://assets/confirm.wav" id="3_je42j"]
[ext_resource type="AudioStream" uid="uid://c86lhi4x3wuyb" path="res://assets/sfx/confirm.wav" id="3_je42j"]

[sub_resource type="InputEventAction" id="InputEventAction_l2p0l"]
action = &"start_game"
Expand Down
8 changes: 7 additions & 1 deletion src/main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ extends Node
set(v):
sfx_game_over = v
update_configuration_warnings()
@export var background_music: AudioStreamPlayer:
set(v):
background_music = v
update_configuration_warnings()
var score: int

func _get_configuration_warnings():
Expand All @@ -28,9 +32,10 @@ func _get_configuration_warnings():
func new_game():
# Reset
score = 0
$Player.start($StartPosition.position)
player.start($StartPosition.position)
get_tree().call_group("mobs", "queue_free")
$StartTimer.start()
background_music.play()

# Update hud
$HUD.update_score(score)
Expand Down Expand Up @@ -64,6 +69,7 @@ func _on_mob_timer_timeout():
add_child(mob)

func game_over():
background_music.stop()
sfx_game_over.play()
$ScoreTimer.stop()
$MobTimer.stop()
Expand Down
12 changes: 9 additions & 3 deletions src/main.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=10 format=3 uid="uid://t6k0gfwo2y5b"]
[gd_scene load_steps=11 format=3 uid="uid://t6k0gfwo2y5b"]

[ext_resource type="PackedScene" uid="uid://dpo75j7ra04cm" path="res://src/characters/player.tscn" id="1_1ufet"]
[ext_resource type="Script" path="res://src/main.gd" id="1_180hn"]
Expand All @@ -7,19 +7,21 @@
[ext_resource type="PackedScene" uid="uid://n4ny5ub0c0bg" path="res://src/hud.tscn" id="4_2dwxb"]
[ext_resource type="TileSet" uid="uid://qf2hqmh4hx0b" path="res://assets/terrain/grass_flat.tres" id="5_52nv5"]
[ext_resource type="SpriteFrames" uid="uid://cxn20r5ped3i5" path="res://assets/troops/sheep/sheep.tres" id="6_n0bua"]
[ext_resource type="AudioStream" uid="uid://03udbys7cv0p" path="res://assets/explosion.wav" id="7_uckn2"]
[ext_resource type="AudioStream" uid="uid://03udbys7cv0p" path="res://assets/sfx/explosion.wav" id="7_uckn2"]
[ext_resource type="AudioStream" uid="uid://r5qlf4177kcm" path="res://assets/Three Red Hearts - Box Jump.ogg" id="9_37vov"]

[sub_resource type="Curve2D" id="Curve2D_4qfgg"]
_data = {
"points": PackedVector2Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 480, 0, 0, 0, 0, 0, 480, 720, 0, 0, 0, 0, 0, 720, 0, 0, 0, 0, 0, 0)
}
point_count = 5

[node name="Main" type="Node" node_paths=PackedStringArray("player", "sfx_game_over")]
[node name="Main" type="Node" node_paths=PackedStringArray("player", "sfx_game_over", "background_music")]
script = ExtResource("1_180hn")
player = NodePath("Player")
mob_scene = ExtResource("2_dncjg")
sfx_game_over = NodePath("Death")
background_music = NodePath("BGMusic")

[node name="BGColor" type="TextureRect" parent="."]
anchors_preset = 15
Expand Down Expand Up @@ -73,6 +75,10 @@ curve = SubResource("Curve2D_4qfgg")
stream = ExtResource("7_uckn2")
volume_db = -15.022

[node name="BGMusic" type="AudioStreamPlayer" parent="."]
stream = ExtResource("9_37vov")
volume_db = -30.77

[connection signal="hit" from="Player" to="." method="game_over"]
[connection signal="timeout" from="MobTimer" to="." method="_on_mob_timer_timeout"]
[connection signal="timeout" from="ScoreTimer" to="." method="_on_score_timer_timeout"]
Expand Down

0 comments on commit 52e8708

Please sign in to comment.