1
0
Fork 0
mirror of https://github.com/tonytins/dressupzack synced 2025-05-08 06:14:48 -04:00

Music and music toggling

This commit is contained in:
Anthony Wilcox 2018-12-31 22:00:31 -05:00
parent 0b04021a9a
commit 0f3187be10
7 changed files with 77 additions and 13 deletions

View file

@ -1,6 +1,7 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=3 format=2]
[ext_resource path="res://src/Interface.gd" type="Script" id=1]
[ext_resource path="res://music/piano.ogg" type="AudioStream" id=2]
[node name="Interface" type="Control" index="0"]
@ -54,14 +55,14 @@ size_flags_horizontal = 1
size_flags_vertical = 1
alignment = 0
[node name="AboutBtn" type="Button" parent="ReferenceRect/VertContainer" index="0"]
[node name="MusicBtn" type="CheckBox" parent="ReferenceRect/VertContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 147.0
margin_bottom = 20.0
margin_bottom = 24.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
@ -69,13 +70,18 @@ mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_colors/font_color_hover = Color( 0, 0, 0, 1 )
custom_colors/font_color_pressed = Color( 0, 0, 0, 1 )
toggle_mode = true
pressed = true
enabled_focus_mode = 2
shortcut = null
group = null
text = "About"
text = "Music"
flat = false
align = 1
align = 0
_sections_unfolded = [ "custom_colors" ]
[node name="CreditsBtn" type="Button" parent="ReferenceRect/VertContainer" index="1"]
@ -83,9 +89,9 @@ anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 24.0
margin_top = 28.0
margin_right = 147.0
margin_bottom = 44.0
margin_bottom = 48.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
@ -101,8 +107,44 @@ text = "Credits"
flat = false
align = 1
[connection signal="pressed" from="ReferenceRect/VertContainer/AboutBtn" to="." method="_on_AboutBtn_pressed"]
[node name="AboutBtn" type="Button" parent="ReferenceRect/VertContainer" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 52.0
margin_right = 147.0
margin_bottom = 72.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "About"
flat = false
align = 1
_sections_unfolded = [ "Margin" ]
[node name="Music" type="AudioStreamPlayer" parent="." index="1"]
stream = ExtResource( 2 )
volume_db = 0.0
pitch_scale = 1.0
autoplay = true
mix_target = 0
bus = "Master"
[connection signal="toggled" from="ReferenceRect/VertContainer/MusicBtn" to="." method="_on_MusicBtn_toggled"]
[connection signal="pressed" from="ReferenceRect/VertContainer/CreditsBtn" to="." method="_on_CreditsBtn_pressed"]
[connection signal="pressed" from="ReferenceRect/VertContainer/AboutBtn" to="." method="_on_AboutBtn_pressed"]

View file

@ -6,7 +6,7 @@
[ext_resource path="res://Clothes.tscn" type="PackedScene" id=4]
[ext_resource path="res://Interface.tscn" type="PackedScene" id=5]
[node name="MainScreen" type="Node2D" index="0"]
[node name="MainScreen" type="Node2D"]
[node name="Background" type="Sprite" parent="." index="0"]

BIN
music/piano.ogg Normal file

Binary file not shown.

15
music/piano.ogg.import Normal file
View file

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

View file

@ -14,3 +14,9 @@ func _on_AboutBtn_pressed():
func _on_CreditsBtn_pressed():
var win_instance = credits_win.instance()
add_child(win_instance)
func _on_MusicBtn_toggled(button_pressed):
if button_pressed == true:
$Music.play()
else:
$Music.stop()

View file

@ -3,8 +3,8 @@
tool
extends Control
const DEFUALT_CONTENT_HEIGHT = 216
const DEFUALT_PANEL_SIZE = Vector2(351, 216)
const DEFUALT_CONTENT_HEIGHT = 217
const DEFUALT_PANEL_SIZE = Vector2(351, 217)
export var toolbar_title = ""
export var content_text = ""

View file

@ -28,7 +28,7 @@ anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 351.0
margin_bottom = 247.0
margin_bottom = 249.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
@ -61,6 +61,7 @@ anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = 1.0
margin_bottom = 1.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0