added basic level selection menu

This commit is contained in:
zoe 2021-09-11 22:35:58 +02:00
parent 8639876921
commit 2637008a33
54 changed files with 756 additions and 32 deletions

2
Menu/Button.gd Normal file
View file

@ -0,0 +1,2 @@
extends Button

View file

@ -0,0 +1,14 @@
extends Button
export var scene = "res://Menu/MainMenu.tscn"
func _on_LevelSelectButton_pressed():
disabled = true
GameStats.reset_board()
var main = get_tree().current_scene
var Fadeout = load("res://Effects/FadeOut.tscn")
var fadeout = Fadeout.instance()
fadeout.scene_to_load = scene
main.add_child(fadeout)

View file

@ -0,0 +1,11 @@
extends TextureButton
export var scene = "res://Menu/MainMenu.tscn"
func _on_LevelSelectIconButton_pressed():
disabled = true
var main = get_tree().current_scene
var Fadeout = load("res://Effects/FadeOut.tscn")
var fadeout = Fadeout.instance()
fadeout.scene_to_load = scene
main.add_child(fadeout)

View file

@ -0,0 +1,13 @@
[gd_scene load_steps=2 format=2]
[ext_resource path="res://Menu/Buttons/LevelSelectIconButton.gd" type="Script" id=1]
[node name="LevelSelectIconButton" type="TextureButton"]
margin_right = 40.0
margin_bottom = 40.0
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="." to="." method="_on_LevelSelectIconButton_pressed"]

View file

@ -0,0 +1,17 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Menu/Theme.tres" type="Theme" id=1]
[ext_resource path="res://Menu/Buttons/LevelSelectButton.gd" type="Script" id=2]
[node name="LevelSelectButton" type="Button"]
margin_right = 34.0
margin_bottom = 23.0
theme = ExtResource( 1 )
text = "01"
flat = true
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="." to="." method="_on_LevelSelectButton_pressed"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/homeIcon1.png-9461cd3b2e92e824230b000d1af9b2a8.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Menu/Icons/Home/homeIcon1.png"
dest_files=[ "res://.import/homeIcon1.png-9461cd3b2e92e824230b000d1af9b2a8.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 324 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/homeIcon2.png-20e23dfb7c52fef1e79c04a9e1da5755.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Menu/Icons/Home/homeIcon2.png"
dest_files=[ "res://.import/homeIcon2.png-20e23dfb7c52fef1e79c04a9e1da5755.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/homeIcon3.png-8340fa6ee8ceed36a6efe6c6775e76cc.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Menu/Icons/Home/homeIcon3.png"
dest_files=[ "res://.import/homeIcon3.png-8340fa6ee8ceed36a6efe6c6775e76cc.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

63
Menu/MainMenu.tscn Normal file
View file

@ -0,0 +1,63 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Menu/Theme.tres" type="Theme" id=1]
[ext_resource path="res://Menu/Buttons/SceneSelectButton.tscn" type="PackedScene" id=2]
[ext_resource path="res://Effects/FadeIn.tscn" type="PackedScene" id=3]
[node name="CanvasLayer" type="CanvasLayer"]
[node name="Control" type="Control" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TabContainer" type="TabContainer" parent="Control"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Main Menu" type="Tabs" parent="Control/TabContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
theme = ExtResource( 1 )
[node name="Levels" type="Tabs" parent="Control/TabContainer"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
theme = ExtResource( 1 )
[node name="GridContainer" type="GridContainer" parent="Control/TabContainer/Levels"]
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="LevelSelectButton" parent="Control/TabContainer/Levels/GridContainer" instance=ExtResource( 2 )]
flat = false
scene = "res://Stages/EmptyStage.tscn"
[node name="Settings" type="Tabs" parent="Control/TabContainer"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 4.0
margin_top = 32.0
margin_right = -4.0
margin_bottom = -4.0
theme = ExtResource( 1 )
[node name="Transition" parent="." instance=ExtResource( 3 )]

View file

@ -30,23 +30,17 @@ __meta__ = {
}
[node name="CenterContainer" type="CenterContainer" parent="Control/Panel"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -160.0
margin_top = -76.0
margin_right = 160.0
margin_bottom = 76.0
anchor_right = 1.0
anchor_bottom = 1.0
__meta__ = {
"_edit_use_anchors_": false
}
[node name="GridContainer" type="GridContainer" parent="Control/Panel/CenterContainer"]
margin_left = 117.0
margin_top = 65.0
margin_right = 203.0
margin_bottom = 87.0
margin_left = 123.0
margin_top = 71.0
margin_right = 209.0
margin_bottom = 93.0
[node name="Heading" type="Label" parent="Control/Panel/CenterContainer/GridContainer"]
margin_right = 86.0
@ -55,8 +49,8 @@ theme = ExtResource( 1 )
text = "you won!"
align = 1
[node name="ButtonRow" type="GridContainer" parent="Control/Panel/CenterContainer/GridContainer"]
[node name="ButtonRow" type="HBoxContainer" parent="Control/Panel/CenterContainer/GridContainer"]
margin_top = 22.0
margin_right = 86.0
margin_bottom = 22.0
columns = 4
alignment = 1

View file

@ -1,11 +1,9 @@
[gd_resource type="Theme" load_steps=7 format=2]
[gd_resource type="Theme" load_steps=6 format=2]
[ext_resource path="res://Font/Papercut/Papercut.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://Font/Yoster-island/Yoster.ttf" type="DynamicFontData" id=2]
[sub_resource type="DynamicFont" id=1]
size = 24
font_data = ExtResource( 1 )
font_data = ExtResource( 2 )
[sub_resource type="DynamicFont" id=2]
size = 18

View file

@ -4,7 +4,7 @@ func _ready():
$AnimationPlayer.play("win")
func _on_AnimationPlayer_animation_finished(anim_name):
func _on_AnimationPlayer_animation_finished(_anim_name):
$Congratulations.visible = false
$Congratulations2.visible = false
$Control.visible = true

View file

@ -1,9 +1,13 @@
[gd_scene load_steps=6 format=2]
[gd_scene load_steps=10 format=2]
[ext_resource path="res://Menu/MenuPage.tscn" type="PackedScene" id=1]
[ext_resource path="res://Menu/Buttons/RestartButton.tscn" type="PackedScene" id=2]
[ext_resource path="res://Menu/Theme.tres" type="Theme" id=3]
[ext_resource path="res://Menu/WinScreen.gd" type="Script" id=4]
[ext_resource path="res://Menu/Buttons/LevelSelectIconButton.tscn" type="PackedScene" id=5]
[ext_resource path="res://Menu/Icons/Home/homeIcon1.png" type="Texture" id=6]
[ext_resource path="res://Menu/Icons/Home/homeIcon2.png" type="Texture" id=7]
[ext_resource path="res://Menu/Icons/Home/homeIcon3.png" type="Texture" id=8]
[sub_resource type="Animation" id=1]
resource_name = "win"
@ -36,15 +40,25 @@ script = ExtResource( 4 )
visible = false
[node name="GridContainer" parent="Control/Panel/CenterContainer" index="0"]
margin_top = 49.0
margin_bottom = 103.0
margin_top = 55.0
margin_bottom = 109.0
[node name="ButtonRow" parent="Control/Panel/CenterContainer/GridContainer" index="1"]
margin_bottom = 54.0
[node name="RestartButton" parent="Control/Panel/CenterContainer/GridContainer/ButtonRow" index="0" instance=ExtResource( 2 )]
margin_left = 9.0
margin_right = 41.0
margin_bottom = 32.0
[node name="LevelSelectIconButton" parent="Control/Panel/CenterContainer/GridContainer/ButtonRow" index="1" instance=ExtResource( 5 )]
margin_left = 45.0
margin_right = 77.0
margin_bottom = 32.0
texture_normal = ExtResource( 6 )
texture_pressed = ExtResource( 8 )
texture_hover = ExtResource( 7 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="1"]
anims/win = SubResource( 1 )