Skip to content

Commit

Permalink
Merge pull request #31 from ligen131/dev-cutekibry
Browse files Browse the repository at this point in the history
添加 BGM
  • Loading branch information
ligen131 authored Jan 28, 2024
2 parents 4d64996 + c8fe40f commit a85e478
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 12 deletions.
8 changes: 4 additions & 4 deletions levels/base_level/base_level.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ centered = false

[node name="SFXs" type="Node" parent="."]

[node name="LevelClear" type="AudioStreamPlayer2D" parent="SFXs"]
[node name="LevelClear" type="AudioStreamPlayer" parent="SFXs"]
stream = ExtResource("3_ou3kh")
volume_db = -5.0
volume_db = -5.622

[node name="WrongAnswer" type="AudioStreamPlayer2D" parent="SFXs"]
[node name="WrongAnswer" type="AudioStreamPlayer" parent="SFXs"]
stream = ExtResource("4_yxsxp")
volume_db = 1.0
volume_db = 4.685

[connection signal="pressed" from="HUDs/NextLevelButton" to="." method="_on_next_level_button_pressed"]
[connection signal="pressed" from="HUDs/BackButton" to="." method="_on_back_button_pressed"]
Expand Down
Binary file added levels/base_level/bgm.wav
Binary file not shown.
24 changes: 24 additions & 0 deletions levels/base_level/bgm.wav.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[remap]

importer="wav"
type="AudioStreamWAV"
uid="uid://cr3nkhf0fejm5"
path="res://.godot/imported/bgm.wav-5645fcab8b652fa4aadb063a7a671992.sample"

[deps]

source_file="res://levels/base_level/bgm.wav"
dest_files=["res://.godot/imported/bgm.wav-5645fcab8b652fa4aadb063a7a671992.sample"]

[params]

force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0
6 changes: 6 additions & 0 deletions main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ func _ready():
func _process(delta):
pass

func _on_main_menu_enter_level():
$BGMPlayer.play()


func _on_bgm_player_finished():
$BGMPlayer.play()
func set_victory(v: bool):
$Bg/DynamicBg.set_victory(v)
15 changes: 13 additions & 2 deletions main.tscn
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
[gd_scene load_steps=4 format=3 uid="uid://c17fbsiogbgo1"]
[gd_scene load_steps=5 format=3 uid="uid://c17fbsiogbgo1"]

[ext_resource type="Script" path="res://main.gd" id="1_d0et0"]
[ext_resource type="PackedScene" uid="uid://c07co5p46apu7" path="res://objects/main_menu/main_menu.tscn" id="1_fk6j6"]
[ext_resource type="Script" path="res://main.gd" id="1_nb6uf"]
[ext_resource type="PackedScene" uid="uid://d3geq38s5fjc6" path="res://bg/dynamic_bg/dynamic_bg.tscn" id="2_8k4il"]
[ext_resource type="AudioStream" uid="uid://cr3nkhf0fejm5" path="res://levels/base_level/bgm.wav" id="3_n81it"]

[node name="Main" type="Node"]
script = ExtResource("1_d0et0")
script = ExtResource("1_nb6uf")

[node name="MainMenu" parent="." instance=ExtResource("1_fk6j6")]

[node name="Bg" type="Node" parent="."]

[node name="DynamicBg" parent="Bg" instance=ExtResource("2_8k4il")]

[node name="BGMPlayer" type="AudioStreamPlayer2D" parent="."]
position = Vector2(234, 150)
stream = ExtResource("3_n81it")
volume_db = -4.685
attenuation = 0.0001

[connection signal="enter_level" from="MainMenu" to="." method="_on_main_menu_enter_level"]
[connection signal="finished" from="BGMPlayer" to="." method="_on_bgm_player_finished"]
4 changes: 2 additions & 2 deletions objects/card/card.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ shape = SubResource("RectangleShape2D_gu6l6")
sprite_frames = SubResource("SpriteFrames_fo0r0")
autoplay = "default"

[node name="SFXPutDown" type="AudioStreamPlayer2D" parent="."]
[node name="SFXPutDown" type="AudioStreamPlayer" parent="."]
stream = ExtResource("7_u4ylf")
volume_db = 6.558
volume_db = 13.117

[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
8 changes: 4 additions & 4 deletions objects/card_base/card_base.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,14 @@ sprite_frames = SubResource("SpriteFrames_bhb3x")

[node name="Cards" type="Node" parent="."]

[node name="SFXPickUp" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("7_0c7kt")
volume_db = 8.54

[node name="FadeTimer" type="Timer" parent="."]
wait_time = 0.2
one_shot = true

[node name="SFXPickUp" type="AudioStreamPlayer" parent="."]
stream = ExtResource("7_0c7kt")
volume_db = 9.58

[connection signal="area_entered" from="." to="." method="_on_area_entered"]
[connection signal="area_exited" from="." to="." method="_on_area_exited"]
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
Expand Down
4 changes: 4 additions & 0 deletions objects/main_menu/main_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ extends AnimatedSprite2D

const ChapterMenu = preload("res://levels/chapter_menu/chapter_menu.tscn")
const BaseLevel := preload("res://levels/base_level/base_level.tscn")

signal enter_level()

# Called when the node enters the scene tree for the first time.
func _ready():
$start_button/AnimatedSprite2D.play()
Expand All @@ -24,6 +27,7 @@ func _on_start_button_pressed():

base_level.init(0, 0)
get_tree().root.add_child(base_level)
enter_level.emit()
queue_free()
#get_tree().root.add_child(ChapterMenu.instantiate())
#queue_free()

0 comments on commit a85e478

Please sign in to comment.