setting up menu
This commit is contained in:
56
scenes/menus/select_mode/select_mode.gd
Normal file
56
scenes/menus/select_mode/select_mode.gd
Normal file
@@ -0,0 +1,56 @@
|
||||
extends Control
|
||||
|
||||
var game_mode
|
||||
var word_select
|
||||
var main_buttons
|
||||
var fade
|
||||
var word_select_button = preload("res://scenes/objects/ui/word_select_button.tscn")
|
||||
|
||||
func check_text_files(path):
|
||||
var dir = DirAccess.open(path)
|
||||
if dir:
|
||||
dir.list_dir_begin()
|
||||
var file_name = dir.get_next()
|
||||
while file_name != "":
|
||||
if not dir.current_is_dir():
|
||||
var set_name = file_name.trim_suffix(".txt").capitalize()
|
||||
var new_select_button = word_select_button.instantiate()
|
||||
new_select_button.text = set_name
|
||||
#print(set_name)
|
||||
word_select.add_child(new_select_button)
|
||||
|
||||
|
||||
file_name = dir.get_next()
|
||||
else:
|
||||
print("An error occurred when trying to access the path.")
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
game_mode = null
|
||||
fade = self.get_node("Fade")
|
||||
fade.visible = true
|
||||
main_buttons = self.get_node("MainButtons")
|
||||
word_select = self.get_node("WordSelectScroll").get_node("WordSelect")
|
||||
check_text_files("res://gameplay/word_sets")
|
||||
|
||||
var tween := create_tween()
|
||||
tween.parallel().tween_property(fade, "modulate:a", 0, 0.5).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_OUT)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
func open_word_menu():
|
||||
pass
|
||||
|
||||
func _on_comet_pressed() -> void:
|
||||
game_mode = "comet"
|
||||
self.get_node("ButtonPress").play()
|
||||
main_buttons.visible = false
|
||||
word_select.visible = true
|
||||
|
||||
func _on_cascade_pressed() -> void:
|
||||
game_mode = "cascade"
|
||||
self.get_node("ButtonPress").play()
|
||||
main_buttons.visible = false
|
||||
word_select.visible = true
|
||||
1
scenes/menus/select_mode/select_mode.gd.uid
Normal file
1
scenes/menus/select_mode/select_mode.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://buqy4h8s5nhg7
|
||||
@@ -1,11 +1,10 @@
|
||||
[gd_scene format=3 uid="uid://cb2i4ei3lihbh"]
|
||||
|
||||
[ext_resource type="Shader" uid="uid://b4yhwgv8l8djq" path="res://scroll.gdshader" id="1_3oan1"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfi22ymi85gjx" path="res://original data/images/menu/cascaded.png" id="2_0p6fv"]
|
||||
[ext_resource type="Texture2D" uid="uid://cjgp2h3x616" path="res://original data/images/menu/cometd.png" id="3_maffk"]
|
||||
[ext_resource type="Texture2D" uid="uid://di5qlm2pud86j" path="res://original data/images/menu/lessond.png" id="4_qgvwr"]
|
||||
[ext_resource type="Texture2D" uid="uid://dqe4as5qrs3r6" path="res://original data/images/menu/tux_configd.png" id="5_1ct8e"]
|
||||
[ext_resource type="Texture2D" uid="uid://y1rcm28rmliw" path="res://original data/images/menu/quitd.png" id="6_m1gal"]
|
||||
[ext_resource type="Script" uid="uid://buqy4h8s5nhg7" path="res://scenes/menus/select_mode/select_mode.gd" id="1_avhy0"]
|
||||
[ext_resource type="Texture2D" uid="uid://dew71sa7dwdnc" path="res://textures/tux typing +.png" id="2_3oan1"]
|
||||
[ext_resource type="AudioStream" uid="uid://df31l8x4fxwf0" path="res://assets/audio/music/menus/Mario Kart Wii Music - Menu (Medley) [fN2dJP0WLDQ].mp3" id="3_xhbdh"]
|
||||
[ext_resource type="AudioStream" uid="uid://podscahsf0d4" path="res://assets/audio/sfx/MenuAccept.wav" id="5_32ulc"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_aeitr"]
|
||||
shader = ExtResource("1_3oan1")
|
||||
@@ -21,6 +20,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_avhy0")
|
||||
|
||||
[node name="Background" type="TextureRect" parent="." unique_id=290638011]
|
||||
material = SubResource("ShaderMaterial_aeitr")
|
||||
@@ -33,53 +33,110 @@ grow_vertical = 2
|
||||
texture = SubResource("CompressedTexture2D_cqx26")
|
||||
stretch_mode = 1
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="." unique_id=1694205679]
|
||||
[node name="TextureRect" type="TextureRect" parent="." unique_id=2036714117]
|
||||
layout_mode = 1
|
||||
anchors_preset = 2
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -140.0
|
||||
offset_top = -332.0
|
||||
offset_right = 514.0
|
||||
offset_bottom = 200.0
|
||||
grow_vertical = 0
|
||||
texture = ExtResource("2_3oan1")
|
||||
expand_mode = 1
|
||||
stretch_mode = 4
|
||||
|
||||
[node name="WordSelectScroll" type="ScrollContainer" parent="." unique_id=920997112]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -288.5
|
||||
offset_top = -360.0
|
||||
offset_right = 288.5
|
||||
offset_bottom = 360.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="WordSelect" type="VBoxContainer" parent="WordSelectScroll" unique_id=56995036]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
alignment = 1
|
||||
|
||||
[node name="MainButtons" type="BoxContainer" parent="." unique_id=881316051]
|
||||
layout_mode = 1
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -288.5
|
||||
offset_top = -222.5
|
||||
offset_right = 288.5
|
||||
offset_bottom = 222.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
vertical = true
|
||||
|
||||
[node name="Cascade" type="Button" parent="MainButtons" unique_id=1019308409]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = "Fish Cascade
|
||||
"
|
||||
expand_icon = true
|
||||
|
||||
[node name="Comet" type="Button" parent="MainButtons" unique_id=1352982543]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = "Comet Zap
|
||||
"
|
||||
expand_icon = true
|
||||
|
||||
[node name="Lessons" type="Button" parent="MainButtons" unique_id=1616574107]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = "Lessons
|
||||
"
|
||||
expand_icon = true
|
||||
|
||||
[node name="Options" type="Button" parent="MainButtons" unique_id=249277019]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = "Options"
|
||||
expand_icon = true
|
||||
|
||||
[node name="Quit" type="Button" parent="MainButtons" unique_id=1080429911]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = "Quit
|
||||
"
|
||||
expand_icon = true
|
||||
|
||||
[node name="BackgroundMusic" type="AudioStreamPlayer2D" parent="." unique_id=1780401057]
|
||||
stream = ExtResource("3_xhbdh")
|
||||
volume_db = -20.0
|
||||
autoplay = true
|
||||
parameters/looping = true
|
||||
|
||||
[node name="ButtonPress" type="AudioStreamPlayer2D" parent="." unique_id=1605257004]
|
||||
stream = ExtResource("5_32ulc")
|
||||
volume_db = -20.0
|
||||
|
||||
[node name="Fade" type="ColorRect" parent="." unique_id=1920157134]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer" unique_id=1812285147]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
|
||||
[node name="Button" type="Button" parent="ScrollContainer/VBoxContainer" unique_id=1019308409]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = "Fish Cascade
|
||||
"
|
||||
icon = ExtResource("2_0p6fv")
|
||||
expand_icon = true
|
||||
|
||||
[node name="Button2" type="Button" parent="ScrollContainer/VBoxContainer" unique_id=1352982543]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = "Comet Zap
|
||||
"
|
||||
icon = ExtResource("3_maffk")
|
||||
expand_icon = true
|
||||
|
||||
[node name="Button3" type="Button" parent="ScrollContainer/VBoxContainer" unique_id=1616574107]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = "Lessons
|
||||
"
|
||||
icon = ExtResource("4_qgvwr")
|
||||
expand_icon = true
|
||||
|
||||
[node name="Button4" type="Button" parent="ScrollContainer/VBoxContainer" unique_id=249277019]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = "Options"
|
||||
icon = ExtResource("5_1ct8e")
|
||||
expand_icon = true
|
||||
|
||||
[node name="Button5" type="Button" parent="ScrollContainer/VBoxContainer" unique_id=1080429911]
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 50
|
||||
text = "Quit
|
||||
"
|
||||
icon = ExtResource("6_m1gal")
|
||||
expand_icon = true
|
||||
[connection signal="pressed" from="MainButtons/Cascade" to="." method="_on_cascade_pressed"]
|
||||
[connection signal="pressed" from="MainButtons/Comet" to="." method="_on_comet_pressed"]
|
||||
|
||||
Reference in New Issue
Block a user