implement level menu
This commit is contained in:
parent
b275630598
commit
6831dd3a3f
8 changed files with 185 additions and 5 deletions
21
gmtk_2024/canvas_layer.tscn
Normal file
21
gmtk_2024/canvas_layer.tscn
Normal file
|
@ -0,0 +1,21 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://7rnltps0ssra"]
|
||||
|
||||
[ext_resource type="Shader" path="res://shaders/crt.gdshader" id="2_wxq0n"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_c8ly2"]
|
||||
shader = ExtResource("2_wxq0n")
|
||||
shader_parameter/crt_curve = 0.02
|
||||
shader_parameter/crt_scan_line_color = 0.347
|
||||
shader_parameter/aperture_grille_rate = 0.4
|
||||
shader_parameter/rf_switch_esque_blur = 1.0
|
||||
shader_parameter/white_noise_rate = 0.0
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer"]
|
||||
|
||||
[node name="ColorRect" type="ColorRect" parent="."]
|
||||
material = SubResource("ShaderMaterial_c8ly2")
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
|
@ -1,6 +1,6 @@
|
|||
[gd_scene load_steps=7 format=4 uid="uid://ctc0arg3efa5k"]
|
||||
[gd_scene load_steps=7 format=4 uid="uid://cvjuhe3a7mskm"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://ba6afuig8bqrg" path="res://levels/LevelBase.tscn" id="1_ad6qp"]
|
||||
[ext_resource type="PackedScene" path="res://levels/LevelBase.tscn" id="1_ad6qp"]
|
||||
[ext_resource type="Texture2D" uid="uid://dr4ayedb5xb2k" path="res://textures/file_editor.png" id="2_gwmxk"]
|
||||
[ext_resource type="Texture2D" uid="uid://c3m4os8kteaix" path="res://textures/level01-spritesheet.png" id="3_3ou1v"]
|
||||
[ext_resource type="PackedScene" uid="uid://vtwswrkfkgas" path="res://objects/EnemyMover.tscn" id="4_3fnma"]
|
||||
|
|
37
gmtk_2024/menu/level_menu/level_button.tscn
Normal file
37
gmtk_2024/menu/level_menu/level_button.tscn
Normal file
|
@ -0,0 +1,37 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://t83eid7pf4iv"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://yg2u8vwwbpv1" path="res://textures/File-Icon.png" id="1_2sfn6"]
|
||||
[ext_resource type="Texture2D" uid="uid://bc2ictes4mln1" path="res://textures/File-Icon-Closed.png" id="2_6ev1f"]
|
||||
[ext_resource type="FontFile" uid="uid://d3pbvdemdbxes" path="res://CommodoreSixtyFour.ttf" id="3_732s0"]
|
||||
[ext_resource type="Script" path="res://scripts/level_menu_level_button.gd" id="3_t0h1w"]
|
||||
|
||||
[node name="LevelButton" type="TextureButton"]
|
||||
custom_minimum_size = Vector2(50, 50)
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
disabled = true
|
||||
texture_normal = ExtResource("1_2sfn6")
|
||||
texture_disabled = ExtResource("2_6ev1f")
|
||||
ignore_texture_size = true
|
||||
stretch_mode = 5
|
||||
script = ExtResource("3_t0h1w")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 3
|
||||
theme_override_fonts/font = ExtResource("3_732s0")
|
||||
theme_override_font_sizes/font_size = 35
|
||||
text = "1"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[connection signal="pressed" from="." to="." method="_on_pressed"]
|
86
gmtk_2024/menu/level_menu/level_select.tscn
Normal file
86
gmtk_2024/menu/level_menu/level_select.tscn
Normal file
|
@ -0,0 +1,86 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://bvvxwhg4tihng"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://cohbys634cf18" path="res://menu/main_menu/MainMenuTheme.tres" id="1_3v0vu"]
|
||||
[ext_resource type="Texture2D" uid="uid://dr4ayedb5xb2k" path="res://textures/file_editor.png" id="1_44xee"]
|
||||
[ext_resource type="Script" path="res://scripts/level_select.gd" id="2_nurro"]
|
||||
[ext_resource type="PackedScene" uid="uid://t83eid7pf4iv" path="res://menu/level_menu/level_button.tscn" id="4_0d7hu"]
|
||||
|
||||
[node name="LevelSelect" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("1_3v0vu")
|
||||
script = ExtResource("2_nurro")
|
||||
|
||||
[node name="Background" type="TextureRect" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
texture = ExtResource("1_44xee")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="Label" type="Label" parent="Background"]
|
||||
layout_mode = 0
|
||||
offset_left = 30.0
|
||||
offset_top = -8.0
|
||||
offset_right = 272.0
|
||||
offset_bottom = 42.0
|
||||
theme_override_font_sizes/font_size = 45
|
||||
text = "level select"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="QuitButton" type="Button" parent="Background"]
|
||||
layout_mode = 0
|
||||
offset_left = 1232.0
|
||||
offset_top = 2.0
|
||||
offset_right = 1270.0
|
||||
offset_bottom = 40.0
|
||||
flat = true
|
||||
|
||||
[node name="ClipControl" type="Control" parent="Background"]
|
||||
layout_mode = 1
|
||||
anchor_left = 0.005
|
||||
anchor_top = 0.11
|
||||
anchor_right = 0.956
|
||||
anchor_bottom = 0.924
|
||||
offset_left = 0.599999
|
||||
offset_top = -0.200005
|
||||
offset_right = 0.319946
|
||||
offset_bottom = -0.280029
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="Background/ClipControl"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
columns = 3
|
||||
|
||||
[node name="LevelButton" parent="Background/ClipControl/GridContainer" instance=ExtResource("4_0d7hu")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="LevelButton2" parent="Background/ClipControl/GridContainer" instance=ExtResource("4_0d7hu")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="LevelButton3" parent="Background/ClipControl/GridContainer" instance=ExtResource("4_0d7hu")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="LevelButton4" parent="Background/ClipControl/GridContainer" instance=ExtResource("4_0d7hu")]
|
||||
layout_mode = 2
|
||||
level_num = 2
|
||||
|
||||
[node name="LevelButton5" parent="Background/ClipControl/GridContainer" instance=ExtResource("4_0d7hu")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="LevelButton6" parent="Background/ClipControl/GridContainer" instance=ExtResource("4_0d7hu")]
|
||||
layout_mode = 2
|
||||
|
||||
[connection signal="pressed" from="Background/QuitButton" to="." method="_on_quit_button_pressed"]
|
|
@ -13,7 +13,7 @@ config_version=5
|
|||
config/name="GMTK_2024"
|
||||
run/main_scene="res://menu/main_menu/MainMenu.tscn"
|
||||
config/features=PackedStringArray("4.3", "GL Compatibility")
|
||||
config/icon="res://temp_assets/icon.svg"
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[display]
|
||||
|
||||
|
@ -50,5 +50,4 @@ click={
|
|||
textures/canvas_textures/default_texture_filter=0
|
||||
renderer/rendering_method="gl_compatibility"
|
||||
renderer/rendering_method.mobile="gl_compatibility"
|
||||
environment/defaults/default_clear_color=Color(0.785573, 0.700355, 0.83902, 1)
|
||||
2d/snap/snap_2d_transforms_to_pixel=true
|
||||
|
|
24
gmtk_2024/scripts/level_menu_level_button.gd
Normal file
24
gmtk_2024/scripts/level_menu_level_button.gd
Normal file
|
@ -0,0 +1,24 @@
|
|||
@tool
|
||||
extends TextureButton
|
||||
|
||||
signal level_selected
|
||||
|
||||
@export var level_num: int = 1
|
||||
@export var locked: bool = true:
|
||||
set(value):
|
||||
locked = value
|
||||
level_locked() if locked else level_unlocked()
|
||||
|
||||
func level_locked() -> void:
|
||||
level_state(true)
|
||||
|
||||
func level_unlocked() -> void:
|
||||
level_state(false)
|
||||
|
||||
func level_state(value: bool) -> void:
|
||||
disabled = value
|
||||
$Label.visible = not value
|
||||
|
||||
|
||||
func _on_pressed():
|
||||
level_selected.emit(level_num)
|
13
gmtk_2024/scripts/level_select.gd
Normal file
13
gmtk_2024/scripts/level_select.gd
Normal file
|
@ -0,0 +1,13 @@
|
|||
extends Control
|
||||
|
||||
func _ready():
|
||||
setup_level_box()
|
||||
|
||||
func setup_level_box():
|
||||
for box in $Background/ClipControl/GridContainer.get_children():
|
||||
box.level_num = box.get_index() + 1
|
||||
box.locked = false
|
||||
|
||||
|
||||
func _on_quit_button_pressed():
|
||||
get_tree().change_scene_to_file("res://menu/main_menu/MainMenu.tscn")
|
|
@ -57,7 +57,7 @@ func _show_menu_options() -> void:
|
|||
|
||||
|
||||
func _on_start_button_pressed() -> void:
|
||||
print("Start Button Clicked")
|
||||
get_tree().change_scene_to_file("res://menu/level_menu/level_select.tscn")
|
||||
|
||||
func _on_credits_button_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://menu/main_menu/CreditsScene.tscn")
|
||||
|
|
Loading…
Add table
Reference in a new issue