diff --git a/graphics/level_select/small_sg.png b/graphics/level_select/small_sg.png index 2739498..00710d9 100644 Binary files a/graphics/level_select/small_sg.png and b/graphics/level_select/small_sg.png differ 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 )