mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-21 15:44:23 +00:00
Add music and fix things
This commit is contained in:
parent
6c3bfb3bf8
commit
8d627efcc9
17 changed files with 134 additions and 60 deletions
|
@ -66,7 +66,7 @@ func _on_sacrifice_changed(_entity: Node2D) -> void:
|
|||
if recipe.do_match(entities):
|
||||
break
|
||||
|
||||
func _on_recipe_matched(m: SummoningRecipe.Match, _recipe: SummoningRecipe) -> void:
|
||||
recipe_matched.emit()
|
||||
func _on_recipe_matched(m: SummoningRecipe.Match, recipe: SummoningRecipe) -> void:
|
||||
recipe_matched.emit(m, recipe)
|
||||
for sacrificable in m.sacrificables:
|
||||
sacrificable.sacrifice()
|
||||
|
|
|
@ -483,6 +483,7 @@ debug_color = Color(1, 0, 0, 0)
|
|||
stream = ExtResource("17_ccla5")
|
||||
bus = &"KillSounds"
|
||||
|
||||
[connection signal="sacrificed" from="Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="changed_direction" from="MovementWander" to="MovementWander/WanderPriority" method="priority_conditional"]
|
||||
[connection signal="move" from="MovementWander" to="." method="_on_move"]
|
||||
[connection signal="move_disabled" from="MovementWander" to="MovementWander" method="clear_direction"]
|
||||
|
|
|
@ -348,6 +348,7 @@ debug_color = Color(1, 0, 0, 0)
|
|||
stream = ExtResource("19_7la6c")
|
||||
bus = &"KillSounds"
|
||||
|
||||
[connection signal="sacrificed" from="Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="timeout" from="GoldSpawner/SpawnTimer" to="GoldSpawner" method="spawn"]
|
||||
[connection signal="changed_direction" from="MovementWander" to="MovementWander/WanderPriority" method="priority_conditional"]
|
||||
[connection signal="move" from="MovementWander" to="." method="_on_move"]
|
||||
|
|
|
@ -222,6 +222,7 @@ bus = &"DragSounds"
|
|||
stream = ExtResource("12_0h21e")
|
||||
bus = &"FallSounds"
|
||||
|
||||
[connection signal="sacrificed" from="Sacrificable" to="." method="queue_free"]
|
||||
[connection signal="changed_target" from="MovementTrap" to="MovementTrap/TrapPriority" method="priority_conditional"]
|
||||
[connection signal="move" from="MovementTrap" to="." method="_on_move"]
|
||||
[connection signal="move_disabled" from="MovementTrap" to="." method="_on_freed"]
|
||||
|
|
|
@ -6,6 +6,7 @@ class_name MainGame
|
|||
@onready var default_spawn_parent: Node2D = %"DefaultSpawnParent"
|
||||
@onready var inventory: Inventory = %"Inventory"
|
||||
@onready var cursor: Cursor = %"Cursor"
|
||||
@onready var music: Music = %"Music"
|
||||
|
||||
|
||||
static func get_via_group(node: Node) -> MainGame:
|
||||
|
@ -20,3 +21,14 @@ func _ready():
|
|||
var gold_counter = inventory.get_counter(&"Gold")
|
||||
gold_counter.changed.connect(cursor.gold_display.change)
|
||||
cursor.gold_display.set_text(gold_counter.value)
|
||||
|
||||
func _on_recipe_matched(m: SummoningRecipe.Match, recipe: SummoningRecipe) -> void:
|
||||
# Quick hack for now
|
||||
match recipe.name:
|
||||
"FiveSheep":
|
||||
music.enable_layer_1()
|
||||
music.do_sync()
|
||||
"FiveImps":
|
||||
music.enable_layer_2()
|
||||
"FiveChupacabra":
|
||||
music.enable_layer_3()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=25 format=3 uid="uid://cxj5aud02f40j"]
|
||||
[gd_scene load_steps=26 format=3 uid="uid://cxj5aud02f40j"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game/main_game.gd" id="1_wiglu"]
|
||||
[ext_resource type="PackedScene" uid="uid://dm068vaseh45n" path="res://scenes/game/game_camera.tscn" id="2_db5xs"]
|
||||
|
@ -6,6 +6,7 @@
|
|||
[ext_resource type="Texture2D" uid="uid://d13j4br4hxek6" path="res://scenes/game/tileset_grass.png" id="2_o7bg5"]
|
||||
[ext_resource type="PackedScene" uid="uid://brvbtvt4em32" path="res://behaviours/counter.tscn" id="3_we8s5"]
|
||||
[ext_resource type="Texture2D" uid="uid://ki0xyx6gvkty" path="res://scenes/game/tileset_flowers.png" id="4_dlm0d"]
|
||||
[ext_resource type="PackedScene" uid="uid://dhrftd3ni6d20" path="res://scenes/game/music.tscn" id="4_q73jh"]
|
||||
[ext_resource type="PackedScene" uid="uid://col1q3elvkfwk" path="res://scenes/game/cursor.tscn" id="5_g504x"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxm3edor0akqj" path="res://scenes/game/tileset_flowers_shaded.png" id="5_yqthh"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3gydtrenbw3n" path="res://entities/skull.tscn" id="6_5k7gy"]
|
||||
|
@ -861,6 +862,9 @@ script = ExtResource("1_wiglu")
|
|||
unique_name_in_owner = true
|
||||
counter_scene = ExtResource("3_we8s5")
|
||||
|
||||
[node name="Music" parent="." instance=ExtResource("4_q73jh")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="FloorTileMap" type="TileMap" parent="."]
|
||||
z_index = -30
|
||||
scale = Vector2(2, 2)
|
||||
|
@ -983,3 +987,5 @@ position = Vector2(341, 247)
|
|||
|
||||
[node name="Tree5" parent="." instance=ExtResource("18_r8twr")]
|
||||
position = Vector2(379, 292)
|
||||
|
||||
[connection signal="recipe_matched" from="SummoningCirclePentagram" to="." method="_on_recipe_matched"]
|
||||
|
|
26
scenes/game/music.gd
Normal file
26
scenes/game/music.gd
Normal file
|
@ -0,0 +1,26 @@
|
|||
extends Node
|
||||
class_name Music
|
||||
|
||||
|
||||
@onready var layer_1: AudioStreamPlayer = %"Layer1"
|
||||
@onready var layer_2: AudioStreamPlayer = %"Layer2"
|
||||
@onready var layer_3: AudioStreamPlayer = %"Layer3"
|
||||
|
||||
|
||||
func do_sync():
|
||||
var position = layer_1.get_playback_position()
|
||||
layer_1.stop()
|
||||
layer_2.stop()
|
||||
layer_3.stop()
|
||||
layer_1.play(position)
|
||||
layer_2.play(position)
|
||||
layer_3.play(position)
|
||||
|
||||
func enable_layer_1():
|
||||
layer_1.volume_db = 0
|
||||
|
||||
func enable_layer_2():
|
||||
layer_2.volume_db = 0
|
||||
|
||||
func enable_layer_3():
|
||||
layer_3.volume_db = 0
|
27
scenes/game/music.tscn
Normal file
27
scenes/game/music.tscn
Normal file
|
@ -0,0 +1,27 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://dhrftd3ni6d20"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/game/music.gd" id="1_qp1t4"]
|
||||
[ext_resource type="AudioStream" uid="uid://pfr5ilmpa2me" path="res://scenes/game/music_1.mp3" id="2_0bhsw"]
|
||||
[ext_resource type="AudioStream" uid="uid://c3h5p4m001fve" path="res://scenes/game/music_2.mp3" id="3_cb8nm"]
|
||||
[ext_resource type="AudioStream" uid="uid://cp85uoga2ga5v" path="res://scenes/game/music_3.mp3" id="4_jcbtb"]
|
||||
|
||||
[node name="Music" type="Node"]
|
||||
script = ExtResource("1_qp1t4")
|
||||
|
||||
[node name="Layer1" type="AudioStreamPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("2_0bhsw")
|
||||
volume_db = -80.0
|
||||
bus = &"Music"
|
||||
|
||||
[node name="Layer2" type="AudioStreamPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("3_cb8nm")
|
||||
volume_db = -80.0
|
||||
bus = &"Music"
|
||||
|
||||
[node name="Layer3" type="AudioStreamPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("4_jcbtb")
|
||||
volume_db = -80.0
|
||||
bus = &"Music"
|
19
scenes/game/music_1.mp3.import
Normal file
19
scenes/game/music_1.mp3.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://pfr5ilmpa2me"
|
||||
path="res://.godot/imported/music_1.mp3-6430d0f78bf931cf6d2e236b4c074449.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://scenes/game/music_1.mp3"
|
||||
dest_files=["res://.godot/imported/music_1.mp3-6430d0f78bf931cf6d2e236b4c074449.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
19
scenes/game/music_2.mp3.import
Normal file
19
scenes/game/music_2.mp3.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://c3h5p4m001fve"
|
||||
path="res://.godot/imported/music_2.mp3-9ad7929d0039d7f2980e17fd57b96f54.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://scenes/game/music_2.mp3"
|
||||
dest_files=["res://.godot/imported/music_2.mp3-9ad7929d0039d7f2980e17fd57b96f54.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
19
scenes/game/music_3.mp3.import
Normal file
19
scenes/game/music_3.mp3.import
Normal file
|
@ -0,0 +1,19 @@
|
|||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://cp85uoga2ga5v"
|
||||
path="res://.godot/imported/music_3.mp3-69017ed8865f2e7206faff017c5be6eb.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://scenes/game/music_3.mp3"
|
||||
dest_files=["res://.godot/imported/music_3.mp3-69017ed8865f2e7206faff017c5be6eb.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=true
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://pfr5ilmpa2me"
|
||||
path="res://.godot/imported/layer1song.mp3-ce6bc20da8db13507fd0fd3e8c653f57.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://temp/layer1song.mp3"
|
||||
dest_files=["res://.godot/imported/layer1song.mp3-ce6bc20da8db13507fd0fd3e8c653f57.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://c3h5p4m001fve"
|
||||
path="res://.godot/imported/layer2song.mp3-bddbe3acc20e065899d402af3799ca36.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://temp/layer2song.mp3"
|
||||
dest_files=["res://.godot/imported/layer2song.mp3-bddbe3acc20e065899d402af3799ca36.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
|
@ -1,19 +0,0 @@
|
|||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://cp85uoga2ga5v"
|
||||
path="res://.godot/imported/layer3song.mp3-5c48dfba6496ab0d326a87278a421d8b.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://temp/layer3song.mp3"
|
||||
dest_files=["res://.godot/imported/layer3song.mp3-5c48dfba6496ab0d326a87278a421d8b.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
Loading…
Reference in a new issue