Add first background music, always move focus back to the command line

This commit is contained in:
blinry 2021-02-04 16:11:56 +01:00
parent 13dc516edf
commit b9b32c66e4
11 changed files with 90 additions and 17 deletions

9
default_bus_layout.tres Normal file
View file

@ -0,0 +1,9 @@
[gd_resource type="AudioBusLayout" format=2]
[resource]
bus/1/name = "SFX"
bus/1/solo = false
bus/1/mute = false
bus/1/bypass_fx = false
bus/1/volume_db = 0.0
bus/1/send = "Master"

Binary file not shown.

View file

@ -0,0 +1,15 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/gigantic-greasy-giraffe.ogg-f6c5f1ef0e57d5d768517fa39e6be36c.oggstr"
[deps]
source_file="res://music/gigantic-greasy-giraffe.ogg"
dest_files=[ "res://.import/gigantic-greasy-giraffe.ogg-f6c5f1ef0e57d5d768517fa39e6be36c.oggstr" ]
[params]
loop=true
loop_offset=0

View file

@ -135,6 +135,11 @@ clear={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":76,"unicode":0,"echo":false,"script":null) "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":true,"meta":false,"command":true,"pressed":false,"scancode":76,"unicode":0,"echo":false,"script":null)
] ]
} }
mute={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":77,"unicode":0,"echo":false,"script":null)
]
}
[network] [network]

View file

@ -177,6 +177,7 @@ func item_deleted(item):
func close(): func close():
text_edit.hide() text_edit.hide()
emit_signal("saved")
func save(): func save():
match mode: match mode:
@ -189,7 +190,6 @@ func save():
helpers.write_file(fixme_path+open_file, text_edit.text) helpers.write_file(fixme_path+open_file, text_edit.text)
update() update()
emit_signal("saved")
close() close()
func _set_commit(new_commit): func _set_commit(new_commit):

View file

@ -1,6 +1,12 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://scenes/game.gd" type="Script" id=1] [ext_resource path="res://scenes/game.gd" type="Script" id=1]
[ext_resource path="res://music/gigantic-greasy-giraffe.ogg" type="AudioStream" id=2]
[node name="Node" type="Node"] [node name="Node" type="Node"]
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="Music" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 2 )
volume_db = -15.0
autoplay = true

View file

@ -63,3 +63,12 @@ func reload():
func toggle_music():
var music = game.find_node("Music")
if music.volume_db > -20:
music.volume_db -= 100
else:
music.volume_db += 100

View file

@ -56,14 +56,24 @@ margin_left = 138.588
margin_top = 59.3009 margin_top = 59.3009
margin_right = 226.588 margin_right = 226.588
margin_bottom = 98.3009 margin_bottom = 98.3009
focus_mode = 0
enabled_focus_mode = 0
text = "Reload" text = "Reload"
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="TextureRect" type="TextureRect" parent="Button2"] [node name="Button3" type="Button" parent="."]
margin_right = 40.0 margin_left = 241.005
margin_bottom = 40.0 margin_top = 58.856
margin_right = 387.005
margin_bottom = 97.856
focus_mode = 0
enabled_focus_mode = 0
text = "Toggle music"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HelpLabel" type="Label" parent="."] [node name="HelpLabel" type="Label" parent="."]
visible = false visible = false
@ -91,4 +101,5 @@ __meta__ = {
} }
[connection signal="pressed" from="Button" to="." method="back"] [connection signal="pressed" from="Button" to="." method="back"]
[connection signal="pressed" from="Button2" to="." method="reload"] [connection signal="pressed" from="Button2" to="." method="reload"]
[connection signal="pressed" from="Button3" to="." method="toggle_music"]
[connection signal="pressed" from="HelpLabel/Button3" to="." method="onSurveyPressed"] [connection signal="pressed" from="HelpLabel/Button3" to="." method="onSurveyPressed"]

View file

@ -66,7 +66,7 @@ func load_level(level_id):
$Menu/CLIBadge.active = true $Menu/CLIBadge.active = true
$Menu/CLIBadge.sparkling = false $Menu/CLIBadge.sparkling = false
AudioServer.set_bus_mute(AudioServer.get_bus_index("Master"), true) AudioServer.set_bus_mute(AudioServer.get_bus_index("SFX"), true)
levels.chapters[game.current_chapter].levels[game.current_level].construct() levels.chapters[game.current_chapter].levels[game.current_level].construct()
@ -112,7 +112,7 @@ func load_level(level_id):
add_child(t) add_child(t)
t.start() t.start()
yield(t, "timeout") yield(t, "timeout")
AudioServer.set_bus_mute(AudioServer.get_bus_index("Master"), false) AudioServer.set_bus_mute(AudioServer.get_bus_index("SFX"), false)
# FIXME: Need to clean these up when switching levels somehow. # FIXME: Need to clean these up when switching levels somehow.
# chapter_select.select(game.current_chapter) # chapter_select.select(game.current_chapter)
@ -205,6 +205,8 @@ func update_repos():
repo.update_everything() repo.update_everything()
file_browser.update() file_browser.update()
input.grab_focus()
func toggle_cards(): func toggle_cards():
cards.visible = not cards.visible cards.visible = not cards.visible

View file

@ -59,6 +59,7 @@ __meta__ = {
[node name="Pop" type="AudioStreamPlayer2D" parent="."] [node name="Pop" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource( 5 ) stream = ExtResource( 5 )
bus = "SFX"
[node name="Area2D" type="Area2D" parent="."] [node name="Area2D" type="Area2D" parent="."]

View file

@ -1,7 +1,7 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=7 format=2]
[ext_resource path="res://styles/theme.tres" type="Theme" id=1] [ext_resource path="res://styles/theme.tres" type="Theme" id=1]
[ext_resource path="res://nodes/head.svg" type="Texture" id=2] [ext_resource path="res://nodes/head1.svg" type="Texture" id=2]
[ext_resource path="res://scenes/title.gd" type="Script" id=3] [ext_resource path="res://scenes/title.gd" type="Script" id=3]
[ext_resource path="res://fonts/cabin-bold.ttf" type="DynamicFontData" id=4] [ext_resource path="res://fonts/cabin-bold.ttf" type="DynamicFontData" id=4]
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=5] [ext_resource path="res://fonts/default.tres" type="DynamicFont" id=5]
@ -24,16 +24,18 @@ __meta__ = {
[node name="ColorRect" type="ColorRect" parent="."] [node name="ColorRect" type="ColorRect" parent="."]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
margin_top = -0.889893
margin_bottom = -0.889893
color = Color( 0, 0, 0, 1 ) color = Color( 0, 0, 0, 1 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Label" type="Label" parent="."] [node name="Label" type="Label" parent="."]
margin_left = 794.213 margin_left = 795.993
margin_top = 255.807 margin_top = 243.349
margin_right = 1117.21 margin_right = 1166.99
margin_bottom = 365.807 margin_bottom = 353.349
custom_fonts/font = SubResource( 1 ) custom_fonts/font = SubResource( 1 )
text = "Git Guru" text = "Git Guru"
__meta__ = { __meta__ = {
@ -53,15 +55,28 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Label3" type="Label" parent="."]
margin_left = 692.22
margin_top = 373.555
margin_right = 1192.22
margin_bottom = 429.555
custom_fonts/font = ExtResource( 5 )
custom_colors/font_color = Color( 0.533333, 0.392157, 0.392157, 1 )
text = "Original score by winniehell"
align = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="head" type="Sprite" parent="."] [node name="head" type="Sprite" parent="."]
position = Vector2( 949.453, 168.805 ) position = Vector2( 944.114, 185.713 )
texture = ExtResource( 2 ) texture = ExtResource( 2 )
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
margin_left = 771.152 margin_left = 765.813
margin_top = 416.996 margin_top = 465.05
margin_right = 1123.15 margin_right = 1117.81
margin_bottom = 599.996 margin_bottom = 648.05
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }