From 3f7da8aa83f5bda745c43bd63749a6f2a393bc70 Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Wed, 28 Feb 2024 14:31:42 -0500 Subject: [PATCH] expand level select menu, implement palettes fully :) --- graphics/level_select/small_sg.png | Bin 674 -> 4373 bytes menus/level_select_scholar.gd | 15 +- menus/level_select_scholar.tscn | 244 ++++++++++++++++++++++++++++- menus/palette_select.gd | 3 + menus/palette_select.tscn | 4 +- 5 files changed, 263 insertions(+), 3 deletions(-) diff --git a/graphics/level_select/small_sg.png b/graphics/level_select/small_sg.png index 2739498bb7fd34ac962102b04ba2a778367a0a7f..00710d9aa26479c8b50bce638ab366d57ec8e888 100644 GIT binary patch literal 4373 zcmeHKdu$X%7~i9nmST&+@)Yf|g-DUTecaw_b7v`cr9I_J0}ZW@i2IoBZQ8p%_V#*L zqKMU?Kmz!P79^<}NEAqwM-cD<2>8H65d)EchBWv_9!ii1qTlXaudSGvCi-9ZGB>l| z{J!7J{N|hQZkE^A)f5*^EW$9XI8+;)2X&!Y3Wvk@!BOw6#4uYaY6>Z#&~&S3BpC8B zTNY>Q*B)le!}7rXER+)4Fl;o`olr)D-Nc(^qU|QD-URL2vh8iqo|eU!{tWmQL%jzI z3++;7Av_ob2Rc1)?Tuj**o zzkl_iO;4=c-d)n&fnTxpoISnadt&N!s$$2}7fZJe)#I!3k#hXIDHX+^T}+NDTX??5_sP{$T~aOCdGm$k2S+S$&*&-cSsUK` zX?vIF{lnYtd8E!K9Jy(E+3xOL*FM;N=FNSM^4TuO+)0zi-s|6TiN5Q$i5Iy=bB-B@ z$LaRX>)-OU92@@Aspt064M!SZ*j?vXQ95>O{s^L!tFIa}wr9tW8#+HavgGK2${(*x z)ho_yTKbG+b4J$OUU{YL+PUL1>cV?MuS_}er+BhVn)&d!h&y`q>X$oD-nsP83A>KI zef|ECoqtSu_rx)=X5R%@e9>3Op7)>D3&yu^`efPJ+9m5|Z7qDK>vQ)vk6$3^UEf|l ze&WL)^44tZKI-1Le=_~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>tj8+nEzVk{##;B}FAV4Pm1VBe97Pg~Sb_u*3Th~$0vmB!by6&(X+PoP zA94K>xfF7h!N{?IDt|P{t{?mles^mXCMUe4a02Llah#7B5ZVQrb;tQWcAVx35PSx% z^tQj+0A@Z(ueY`65iqa~TwJ#`We>RA0fwIp*_2%=NK+^jfcG={rW`PI3-qmdy|wmn z`T%68tJDo}a0rYQDSO@L-MyW?{d=a>-w%yPaH|gqCdIMKi zrN`*@?$TN4;O;&0hKHr1nG*h=d?7MvF}gfmAOI9^$6RF|=)(UwdI%6*U~xl44@oyf zYS?6PtUG`iZPh(lie6@%WX4H~KJ7^e_LfaOps5G2w|pJ>IlqtQANz$T5paB9%~b#Z N002ovPDHLkV1hL708jt` diff --git a/menus/level_select_scholar.gd b/menus/level_select_scholar.gd index c79aa4f..a13b4c9 100644 --- a/menus/level_select_scholar.gd +++ b/menus/level_select_scholar.gd @@ -29,6 +29,8 @@ onready var shards_block: HBoxContainer = $"%ShardsBlock" onready var shards_needed: Label = $"%ShardsNeeded" func _ready() -> void: + var palette = load("res://graphics/player/palettes/%s.png" % Game.current_palette) + player_sprite.material.set_shader_param("palette", palette) $ShardCount.text = "%02d" % Save.current_file.get_total_shards() Fade.fade_in(Options.transition_speed_secs) Audio.ac_music.stop() @@ -83,9 +85,15 @@ func _process(delta: float) -> void: else: player_sprite.visible = true + +func _input(event: InputEvent) -> void: + if event.is_action_pressed("ui_cancel") and $"%MenuPopup".rect_scale.y >= 1.0: + animation_player.play("hide_menu") + + func _gui_input(event: InputEvent) -> void: if event.is_action_pressed("ui_cancel"): - animation_player.play("show_exit") + animation_player.play("show_menu") if not made_selection: # player is walking around if event.is_action_pressed("ui_accept"): _update_stats() @@ -118,6 +126,7 @@ func _gui_input(event: InputEvent) -> void: func _select_level(level_id: int) -> void: var level = LevelData.levels[level_id] selected_level = level_id + Game.current_level = selected_level # hide arrows at edges of leve set if level_id == 0: back_arrow.modulate.a = 0.0 @@ -197,3 +206,7 @@ func _on_ExitMenu_pressed() -> void: Fade.fade_out(Options.transition_speed_secs) yield(Fade, "fade_finished") SceneManager.current_scene = load("res://menus/main_menu.tscn").instance() + + +func _on_PalettesButton_button_down() -> void: + SceneManager.current_scene = load("res://menus/palette_select.tscn").instance() diff --git a/menus/level_select_scholar.tscn b/menus/level_select_scholar.tscn index 82a16d1..4e7ef08 100644 --- a/menus/level_select_scholar.tscn +++ b/menus/level_select_scholar.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=27 format=2] +[gd_scene load_steps=32 format=2] [ext_resource path="res://menus/level_select_scholar.gd" type="Script" id=1] [ext_resource path="res://graphics/level_select/world_map.png" type="Texture" id=2] @@ -15,6 +15,8 @@ [ext_resource path="res://graphics/level_select/wave_particle.png" type="Texture" id=13] [ext_resource path="res://graphics/hud/levelselect_arrow.png" type="Texture" id=14] [ext_resource path="res://graphics/level_select/whirlpool.png" type="Texture" id=15] +[ext_resource path="res://graphics/player/palettes/default.png" type="Texture" id=16] +[ext_resource path="res://shaders/recolor.tres" type="Shader" id=17] [sub_resource type="CanvasItemMaterial" id=9] particles_animation = true @@ -27,6 +29,10 @@ _data = { "points": PoolVector2Array( -2.9375, -8.1875, 2.9375, 8.1875, 61, 140, -4.4375, -0.0625, 4.4375, 0.0625, 78, 149, -4.15425, 1.32583, 4.15425, -1.32583, 96, 148, -1.65424, 3.52941, 1.65424, -3.52941, 112, 142, -1.88775, 1.4748, 1.88775, -1.4748, 113, 134, 0, 0, 0, 0, 119, 134, -1.08543, 0.828444, 1.08543, -0.828444, 125, 134, 2.83044, 1.16526, -2.83044, -1.16526, 125, 128, -0.794597, 4.50272, 0.794597, -4.50272, 123, 106, -4.30959, 1.47157, 4.30959, -1.47157, 130, 93, -11.05, -1.311, 11.05, 1.311, 141, 96, -1.31102, 2.24746, 1.31102, -2.24746, 155, 99, -2.22725, 4.12041, 2.22725, -4.12041, 162, 84, -4.89994, 0, 4.89994, 0, 172, 75, 0, -4.73004, 0, 4.73004, 184, 88, 0, -4.51982, 0, 4.51982, 177, 100, -3.88915, 0.630672, 3.88915, -0.630672, 185, 107, -0.630672, -4.62493, 0.630672, 4.62493, 192, 118, 1.05112, -1.99713, -1.05112, 1.99713, 190, 128, 2.6278, -0.420448, -2.6278, 0.420448, 184, 132, 1.78381, -1.78381, -1.78381, 1.78381, 175, 132, -6.30672, -0.210224, 6.30672, 0.210224, 181, 137, -0.225119, 1.75324, 0.225119, -1.75324, 204, 130, -8.92331, -2.0232, 5.373, 1.21823, 212, 119, 4.62446, -6.34857, -4.62446, 6.34857, 202, 143, 4.51982, -0.420448, -4.51982, 0.420448, 174, 154, 4.83515, 0.315336, -4.83515, -0.315336, 152, 154, 4.60818, 2.75004, -4.60818, -2.75004, 136, 149, 3.67496, 4.00905, -3.67496, -4.00905, 127, 142, 3.95539, -2.40938, -3.95539, 2.40938, 123, 128, 4.56378, -0.496063, -4.56378, 0.496063, 109, 124, 1.78583, -5.5559, -1.78583, 5.5559, 102, 131, 6.15118, -3.86929, -6.15118, 3.86929, 96, 140, 5.5559, 0.694488, -5.5559, -0.694488, 75, 142, 0, 0, 0, 0, 62, 130 ) } +[sub_resource type="ShaderMaterial" id=15] +shader = ExtResource( 17 ) +shader_param/palette = ExtResource( 16 ) + [sub_resource type="ShaderMaterial" id=2] shader = ExtResource( 7 ) shader_param/speed = Vector2( 4, 0 ) @@ -101,6 +107,30 @@ tracks/3/keys = { "update": 0, "values": [ Vector2( 1e-05, 0.011 ) ] } +tracks/4/type = "value" +tracks/4/path = NodePath("MenuPopup:visible") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ false ] +} +tracks/5/type = "value" +tracks/5/path = NodePath("MenuPopup:rect_scale") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ) ] +} [sub_resource type="Animation" id=11] resource_name = "hide_exit" @@ -130,6 +160,59 @@ tracks/1/keys = { "values": [ Vector2( 1, 1 ), Vector2( 1, 0.07 ), Vector2( 0, 0.07 ) ] } tracks/2/type = "method" +tracks/2/path = NodePath("MenuPopup/PanelContainer/VBoxContainer/Menu/MenuButton") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0.4 ), +"transitions": PoolRealArray( 1 ), +"values": [ { +"args": [ ], +"method": "grab_focus" +} ] +} +tracks/3/type = "method" +tracks/3/path = NodePath("ExitPopup") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/keys = { +"times": PoolRealArray( ), +"transitions": PoolRealArray( ), +"values": [ ] +} + +[sub_resource type="Animation" id=13] +resource_name = "hide_menu" +length = 0.4 +tracks/0/type = "value" +tracks/0/path = NodePath("MenuPopup:visible") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0.4 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ false ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("MenuPopup:rect_scale") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 0.2, 0.4 ), +"transitions": PoolRealArray( 1, 1, 1 ), +"update": 0, +"values": [ Vector2( 1, 1 ), Vector2( 1, 0.035 ), Vector2( 1e-05, 0.035 ) ] +} +tracks/2/type = "method" tracks/2/path = NodePath(".") tracks/2/interp = 1 tracks/2/loop_wrap = true @@ -214,6 +297,48 @@ tracks/2/keys = { } ] } +[sub_resource type="Animation" id=14] +resource_name = "show_menu" +length = 0.4 +tracks/0/type = "value" +tracks/0/path = NodePath("MenuPopup:visible") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"update": 1, +"values": [ true ] +} +tracks/1/type = "value" +tracks/1/path = NodePath("MenuPopup:rect_scale") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/keys = { +"times": PoolRealArray( 0, 0.2, 0.4 ), +"transitions": PoolRealArray( 1, 1, 1 ), +"update": 0, +"values": [ Vector2( 1e-05, 0.035 ), Vector2( 1, 0.035 ), Vector2( 1, 1 ) ] +} +tracks/2/type = "method" +tracks/2/path = NodePath("MenuPopup/PanelContainer/VBoxContainer/Resume/ResumeButton") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/keys = { +"times": PoolRealArray( 0 ), +"transitions": PoolRealArray( 1 ), +"values": [ { +"args": [ ], +"method": "grab_focus" +} ] +} + [sub_resource type="Animation" id=7] resource_name = "show_stats" length = 0.4 @@ -279,6 +404,7 @@ rotate = false [node name="PlayerSprite" type="Sprite" parent="LevelPath/PlayerPosition"] unique_name_in_owner = true +material = SubResource( 15 ) position = Vector2( 0, -2 ) texture = ExtResource( 3 ) @@ -619,8 +745,10 @@ offset = Vector2( 5, 0 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="."] anims/RESET = SubResource( 6 ) anims/hide_exit = SubResource( 11 ) +anims/hide_menu = SubResource( 13 ) anims/hide_stats = SubResource( 8 ) anims/show_exit = SubResource( 12 ) +anims/show_menu = SubResource( 14 ) anims/show_stats = SubResource( 7 ) [node name="ShardCount" type="Label" parent="."] @@ -639,6 +767,117 @@ text = "72" [node name="Shard" parent="." instance=ExtResource( 11 )] position = Vector2( 4, 5 ) +[node name="MenuPopup" type="CenterContainer" parent="."] +unique_name_in_owner = true +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +rect_pivot_offset = Vector2( 128, 96 ) +theme = ExtResource( 4 ) + +[node name="PanelContainer" type="PanelContainer" parent="MenuPopup"] +margin_left = 125.0 +margin_top = 93.0 +margin_right = 131.0 +margin_bottom = 99.0 + +[node name="VBoxContainer" type="VBoxContainer" parent="MenuPopup/PanelContainer"] +margin_left = 3.0 +margin_top = 3.0 +margin_right = 74.0 +margin_bottom = 55.0 + +[node name="Resume" type="HBoxContainer" parent="MenuPopup/PanelContainer/VBoxContainer"] +margin_right = 71.0 +margin_bottom = 10.0 +custom_constants/separation = 0 +alignment = 1 + +[node name="ResumeButton" type="TextureButton" parent="MenuPopup/PanelContainer/VBoxContainer/Resume"] +unique_name_in_owner = true +margin_left = 10.0 +margin_right = 18.0 +margin_bottom = 10.0 +rect_min_size = Vector2( 8, 8 ) +button_mask = 0 +texture_focused = ExtResource( 5 ) +expand = true +stretch_mode = 3 + +[node name="Label" type="Label" parent="MenuPopup/PanelContainer/VBoxContainer/Resume"] +margin_left = 18.0 +margin_right = 60.0 +margin_bottom = 10.0 +text = "resume" + +[node name="Palettes" type="HBoxContainer" parent="MenuPopup/PanelContainer/VBoxContainer"] +margin_top = 14.0 +margin_right = 71.0 +margin_bottom = 24.0 +custom_constants/separation = 0 +alignment = 1 + +[node name="PalettesButton" type="TextureButton" parent="MenuPopup/PanelContainer/VBoxContainer/Palettes"] +margin_left = 3.0 +margin_right = 11.0 +margin_bottom = 10.0 +rect_min_size = Vector2( 8, 8 ) +button_mask = 0 +texture_focused = ExtResource( 5 ) +expand = true +stretch_mode = 3 + +[node name="Label" type="Label" parent="MenuPopup/PanelContainer/VBoxContainer/Palettes"] +margin_left = 11.0 +margin_right = 67.0 +margin_bottom = 10.0 +text = "palettes" + +[node name="Totals" type="HBoxContainer" parent="MenuPopup/PanelContainer/VBoxContainer"] +margin_top = 28.0 +margin_right = 71.0 +margin_bottom = 38.0 +custom_constants/separation = 0 +alignment = 1 + +[node name="TotalsButton" type="TextureButton" parent="MenuPopup/PanelContainer/VBoxContainer/Totals"] +margin_left = 10.0 +margin_right = 18.0 +margin_bottom = 10.0 +rect_min_size = Vector2( 8, 8 ) +button_mask = 0 +texture_focused = ExtResource( 5 ) +expand = true +stretch_mode = 3 + +[node name="Label" type="Label" parent="MenuPopup/PanelContainer/VBoxContainer/Totals"] +margin_left = 18.0 +margin_right = 60.0 +margin_bottom = 10.0 +text = "totals" + +[node name="Menu" type="HBoxContainer" parent="MenuPopup/PanelContainer/VBoxContainer"] +margin_top = 42.0 +margin_right = 71.0 +margin_bottom = 52.0 +custom_constants/separation = 0 +alignment = 1 + +[node name="MenuButton" type="TextureButton" parent="MenuPopup/PanelContainer/VBoxContainer/Menu"] +margin_right = 8.0 +margin_bottom = 10.0 +rect_min_size = Vector2( 8, 8 ) +button_mask = 0 +texture_focused = ExtResource( 5 ) +expand = true +stretch_mode = 3 + +[node name="Label" type="Label" parent="MenuPopup/PanelContainer/VBoxContainer/Menu"] +margin_left = 8.0 +margin_right = 71.0 +margin_bottom = 10.0 +text = "main menu" + [node name="ExitPopup" type="CenterContainer" parent="."] unique_name_in_owner = true visible = false @@ -687,5 +926,8 @@ margin_bottom = 10.0 size_flags_horizontal = 3 text = "yeppers!" +[connection signal="button_down" from="MenuPopup/PanelContainer/VBoxContainer/Resume/ResumeButton" to="AnimationPlayer" method="play" binds= [ "hide_menu" ]] +[connection signal="button_down" from="MenuPopup/PanelContainer/VBoxContainer/Palettes/PalettesButton" to="." method="_on_PalettesButton_button_down"] +[connection signal="button_down" from="MenuPopup/PanelContainer/VBoxContainer/Menu/MenuButton" to="AnimationPlayer" method="play" binds= [ "show_exit" ]] [connection signal="pressed" from="ExitPopup/PanelContainer/VBoxContainer/HBoxContainer/StayHere" to="." method="_on_StayHere_pressed"] [connection signal="pressed" from="ExitPopup/PanelContainer/VBoxContainer/HBoxContainer/ExitMenu" to="." method="_on_ExitMenu_pressed"] diff --git a/menus/palette_select.gd b/menus/palette_select.gd index 7685d83..2d8bf0b 100644 --- a/menus/palette_select.gd +++ b/menus/palette_select.gd @@ -30,3 +30,6 @@ func _input(event: InputEvent) -> void: current_palette = posmod(current_palette, palettes.size()) sg.material.set_shader_param("palette", palettes[current_palette]) $"%PaletteTitle".text = titles[current_palette] + Game.current_palette = palettes[current_palette].resource_path.get_file().get_basename() + Save.current_file.palette = Game.current_palette + Save.current_file.save_to_file() diff --git a/menus/palette_select.tscn b/menus/palette_select.tscn index 760fc6b..41c4b1e 100644 --- a/menus/palette_select.tscn +++ b/menus/palette_select.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=19 format=2] +[gd_scene load_steps=20 format=2] [ext_resource path="res://shaders/ska_plane.gdshader" type="Shader" id=1] [ext_resource path="res://ui/theme.tres" type="Theme" id=2] @@ -14,6 +14,7 @@ [ext_resource path="res://graphics/player/palettes/lasertag.png" type="Texture" id=12] [ext_resource path="res://graphics/player/palettes/strawberry.png" type="Texture" id=13] [ext_resource path="res://graphics/player/palettes/db32.png" type="Texture" id=14] +[ext_resource path="res://menus/level_select_scholar.tscn" type="PackedScene" id=15] [sub_resource type="ShaderMaterial" id=1] shader = ExtResource( 1 ) @@ -52,6 +53,7 @@ theme = ExtResource( 2 ) script = ExtResource( 3 ) titles = [ "Default", "Dawnbringer", "Lasertag", "Ms. X", "Strawberry" ] palettes = [ ExtResource( 7 ), ExtResource( 14 ), ExtResource( 12 ), ExtResource( 11 ), ExtResource( 13 ) ] +previous_screen = ExtResource( 15 ) [node name="ColorRect" type="ColorRect" parent="."] material = SubResource( 1 )