From 2eb63be2caaf06e0bebea8b36feb7056a78a1717 Mon Sep 17 00:00:00 2001 From: Harmony Honey Date: Fri, 19 Jan 2024 16:13:10 -0500 Subject: [PATCH] WIP Key.tscn rebinding keys (-; Stage stats on pause! rework 2-2 note! F12 debug_refresh hotkey to refresh_scenes() fix double wipe_scene() now only first one (= --- project.godot | 6 ++ src/autoload/Pause.gd | 1 + src/autoload/Shared.gd | 29 ++++- src/autoload/UI.gd | 41 +++++-- src/autoload/UI.tscn | 222 +++++++++++++++++++++++++++++--------- src/map/2-2.tscn | 8 +- src/menu/StartMenu.gd | 9 +- src/menu/StartMenu.tscn | 1 + src/menu/options/Key.gd | 29 +++++ src/menu/options/Key.tscn | 41 +++++++ src/menu/select.gd | 15 +-- 11 files changed, 323 insertions(+), 79 deletions(-) create mode 100644 src/menu/options/Key.gd create mode 100644 src/menu/options/Key.tscn diff --git a/project.godot b/project.godot index e8e4fd1..00db542 100644 --- a/project.godot +++ b/project.godot @@ -241,6 +241,12 @@ screenshot={ "events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777252,"physical_scancode":0,"unicode":0,"echo":false,"script":null) ] } +debug_refresh={ +"deadzone": 0.5, +"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777255,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777235,"physical_scancode":0,"unicode":0,"echo":false,"script":null) + ] +} [input_devices] diff --git a/src/autoload/Pause.gd b/src/autoload/Pause.gd index 144e14e..9db4883 100644 --- a/src/autoload/Pause.gd +++ b/src/autoload/Pause.gd @@ -60,6 +60,7 @@ func toggle_pause(): is_paused = !is_paused node_parent.visible = is_paused UI.keys(is_paused, is_paused, true, is_paused) + UI.stats.visible = is_paused TouchScreen.turn_arrows(is_paused) clock = timer diff --git a/src/autoload/Shared.gd b/src/autoload/Shared.gd index e165a57..cd09ff0 100644 --- a/src/autoload/Shared.gd +++ b/src/autoload/Shared.gd @@ -102,6 +102,10 @@ func _ready(): Wipe.connect("finish", self, "wipe_finish") +func _input(event): + if event.is_action_pressed("debug_refresh"): + refresh_scenes() + func _physics_process(delta): if is_in_game: # map time @@ -144,7 +148,10 @@ func refresh_scenes(): scene_dict[i] = load(i) func wipe_scene(arg := scene_path, timer := 0.0): - if timer > 0.0: yield(get_tree().create_timer(timer), "timeout") + if Wipe.is_wipe: return + if timer > 0.0: + yield(get_tree().create_timer(timer), "timeout") + if Wipe.is_wipe: return scene_last = scene_path scene_path = arg Wipe.start() @@ -182,16 +189,15 @@ func change_map(): i.visible = false is_note = false - UI.notes.visible = is_level_select - UI.notes_label.text = str(count_notes) - UI.gems.visible = is_level_select - UI.gems_label.text = str(count_gems) + UI.map.visible = is_level_select + UI.keys(false, false) UI.labels("pick", "erase" if scene_path == creator_path else "back", "score" if is_level_select else "pause") if is_in_game: TouchScreen.turn_arrows(false) TouchScreen.show_keys(true, true, true, true, true) + UI.show_stats() if is_replay or is_replay_note: var m = map_name + ("-note" if is_replay_note else "") @@ -214,6 +220,11 @@ func change_map(): last_menu = "open" last_cursor = 0 + + UI.notes.visible = count_notes > 0 + UI.notes_label.text = str(count_notes) + UI.gems_label.text = str(count_gems) + elif scene_path == main_menu_path: UI.keys(true, true, false) TouchScreen.turn_arrows(true) @@ -228,6 +239,14 @@ func change_map(): elif scene_path == creator_path: UI.keys(true, true, false) +func time_to_string(arg := 0.0): + var time = arg * (1.0/60.0) + if time < 60.0: + return str(time).pad_decimals(2) + else: + return str(time / 60.0).pad_zeros(2).pad_decimals(0) + ":" + str(fposmod(time, 60.0)).pad_zeros(2).pad_decimals(0) + + ### Saving and Loading func save_file(fname, arg): diff --git a/src/autoload/UI.gd b/src/autoload/UI.gd index ee5244f..1522f05 100644 --- a/src/autoload/UI.gd +++ b/src/autoload/UI.gd @@ -4,19 +4,29 @@ onready var x := $Center/Control/List/X onready var x_label := $Center/Control/List/X/Desc onready var c := $Center/Control/List/C onready var c_label := $Center/Control/List/C/Desc +onready var spacer := $Center/Control/List/Spacer + onready var top := $Center/Control/Top onready var pause_label := $Center/Control/Top/P/Desc -onready var notes := $Center/Control/Notes -onready var notes_label := $Center/Control/Notes/Label -onready var gems := $Center/Control/Gems -onready var gems_label := $Center/Control/Gems/Label +onready var map := $Center/Control/Map +onready var notes := $Center/Control/Map/Notes +onready var notes_label := $Center/Control/Map/Notes/Label +onready var gems := $Center/Control/Map/Gems +onready var gems_label := $Center/Control/Map/Gems/Label -onready var spacer := $Center/Control/List/Spacer +onready var stats := $Center/Control/Stats +onready var stat_time := $Center/Control/Stats/Time +onready var stat_time_label := $Center/Control/Stats/Time/Label +onready var stat_note := $Center/Control/Stats/Note +onready var stat_note_label := $Center/Control/Stats/Note/Label +onready var stat_die := $Center/Control/Stats/Die +onready var stat_die_label := $Center/Control/Stats/Die/Label func _ready(): keys(false, false) - notes.visible = false + map.visible = false + stats.visible = false func keys(left := true, right := true, is_expand := true, _top := false): x.visible = left @@ -28,3 +38,22 @@ func labels(_x := "pick", _c := "back", _pause := "pause"): x_label.text = _x c_label.text = _c pause_label.text = _pause + +func show_stats(): + var m = {} + if Shared.save_maps.has(Shared.map_name): + m = Shared.save_maps[Shared.map_name] + var has_die : bool = m.has("die") + stat_die.visible = has_die + if has_die: + stat_die_label.text = str(m["die"]) + + var has_time : bool = m.has("time") + stat_time.visible = has_time + if has_time: + stat_time_label.text = Shared.time_to_string(m["time"]) + + var has_note : bool = m.has("note") + stat_note.visible = has_note + if has_note: + stat_note_label.text = Shared.time_to_string(m["note"]) diff --git a/src/autoload/UI.tscn b/src/autoload/UI.tscn index af5b397..85852f1 100644 --- a/src/autoload/UI.tscn +++ b/src/autoload/UI.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=12 format=2] +[gd_scene load_steps=17 format=2] [ext_resource path="res://media/font/QuinqueFive.ttf" type="DynamicFontData" id=1] [ext_resource path="res://media/image/diamond12.png" type="Texture" id=2] @@ -6,18 +6,15 @@ [ext_resource path="res://media/image/note.png" type="Texture" id=4] [ext_resource path="res://media/font/m6x11.ttf" type="DynamicFontData" id=5] [ext_resource path="res://src/shader/outline2D_outer.shader" type="Shader" id=6] -[ext_resource path="res://media/font/NicoPaint-Regular.ttf" type="DynamicFontData" id=8] - -[sub_resource type="DynamicFont" id=4] -outline_size = 1 -outline_color = Color( 0, 0, 0, 1 ) -extra_spacing_bottom = -4 -font_data = ExtResource( 8 ) +[ext_resource path="res://src/menu/options/Key.tscn" type="PackedScene" id=7] +[ext_resource path="res://media/image/skull.png" type="Texture" id=8] +[ext_resource path="res://media/image/menu.png" type="Texture" id=9] [sub_resource type="DynamicFont" id=3] size = 5 outline_size = 1 outline_color = Color( 0, 0, 0, 1 ) +extra_spacing_top = -1 extra_spacing_bottom = -1 font_data = ExtResource( 1 ) @@ -33,6 +30,34 @@ extra_spacing_bottom = -3 extra_spacing_char = 1 font_data = ExtResource( 5 ) +[sub_resource type="ShaderMaterial" id=11] +shader = ExtResource( 6 ) +shader_param/line_color = Color( 0, 0, 0, 1 ) +shader_param/line_thickness = 1.0 + +[sub_resource type="DynamicFont" id=12] +size = 5 +outline_size = 1 +outline_color = Color( 0, 0, 0, 1 ) +extra_spacing_top = -1 +extra_spacing_bottom = -1 +extra_spacing_char = 1 +font_data = ExtResource( 1 ) + +[sub_resource type="ShaderMaterial" id=9] +shader = ExtResource( 6 ) +shader_param/line_color = Color( 0, 0, 0, 1 ) +shader_param/line_thickness = 1.0 + +[sub_resource type="DynamicFont" id=10] +size = 5 +outline_size = 1 +outline_color = Color( 0, 0, 0, 1 ) +extra_spacing_top = -1 +extra_spacing_bottom = -1 +extra_spacing_char = 1 +font_data = ExtResource( 1 ) + [node name="UI" type="CanvasLayer"] pause_mode = 2 layer = 5 @@ -55,72 +80,76 @@ margin_bottom = 123.0 custom_constants/separation = 0 [node name="X" type="HBoxContainer" parent="Center/Control/List"] -margin_right = 39.0 +margin_right = 37.0 margin_bottom = 12.0 -custom_constants/separation = 2 +custom_constants/separation = 4 -[node name="Key" type="Label" parent="Center/Control/List/X"] -modulate = Color( 1, 0, 0.301961, 1 ) -margin_right = 13.0 -margin_bottom = 12.0 -custom_fonts/font = SubResource( 4 ) +[node name="Key" parent="Center/Control/List/X" instance=ExtResource( 7 )] +margin_top = 1.0 +margin_right = 9.0 +margin_bottom = 10.0 +rect_min_size = Vector2( 9, 9 ) text = "x" -uppercase = true [node name="Desc" type="Label" parent="Center/Control/List/X"] -margin_left = 15.0 +margin_left = 13.0 margin_top = 3.0 -margin_right = 39.0 -margin_bottom = 9.0 +margin_right = 37.0 +margin_bottom = 8.0 custom_fonts/font = SubResource( 3 ) text = "pick" [node name="Spacer" type="Control" parent="Center/Control/List"] -margin_left = 39.0 -margin_right = 173.0 +margin_left = 37.0 +margin_right = 175.0 margin_bottom = 12.0 rect_min_size = Vector2( 4, 0 ) size_flags_horizontal = 3 [node name="C" type="HBoxContainer" parent="Center/Control/List"] -margin_left = 173.0 +margin_left = 175.0 margin_right = 218.0 margin_bottom = 12.0 -custom_constants/separation = 2 +rect_pivot_offset = Vector2( -248, -67 ) +custom_constants/separation = 4 -[node name="Key" type="Label" parent="Center/Control/List/C"] -modulate = Color( 1, 0, 0.301961, 1 ) -margin_right = 13.0 -margin_bottom = 12.0 -custom_fonts/font = SubResource( 4 ) +[node name="Key" parent="Center/Control/List/C" instance=ExtResource( 7 )] +margin_top = 1.0 +margin_right = 9.0 +margin_bottom = 10.0 +rect_min_size = Vector2( 9, 9 ) text = "c" -uppercase = true [node name="Desc" type="Label" parent="Center/Control/List/C"] -margin_left = 15.0 +margin_left = 13.0 margin_top = 3.0 -margin_right = 45.0 -margin_bottom = 9.0 +margin_right = 43.0 +margin_bottom = 8.0 custom_fonts/font = SubResource( 3 ) text = "erase" -[node name="Notes" type="Control" parent="Center/Control"] +[node name="Map" type="Control" parent="Center/Control"] +visible = false +margin_right = 40.0 +margin_bottom = 40.0 + +[node name="Notes" type="Control" parent="Center/Control/Map"] margin_left = 1.0 margin_top = 19.0 margin_right = 1.0 margin_bottom = 19.0 -[node name="Control" type="Control" parent="Center/Control/Notes"] +[node name="Control" type="Control" parent="Center/Control/Map/Notes"] margin_top = -2.0 margin_right = 16.0 margin_bottom = 14.0 -[node name="Sprite" type="Sprite" parent="Center/Control/Notes/Control"] +[node name="Sprite" type="Sprite" parent="Center/Control/Map/Notes/Control"] material = SubResource( 6 ) position = Vector2( 8, 8 ) texture = ExtResource( 4 ) -[node name="Label" type="Label" parent="Center/Control/Notes"] +[node name="Label" type="Label" parent="Center/Control/Map/Notes"] margin_left = 17.0 margin_right = 78.0 margin_bottom = 11.0 @@ -128,23 +157,23 @@ custom_fonts/font = SubResource( 8 ) text = "13" valign = 1 -[node name="Gems" type="Control" parent="Center/Control"] +[node name="Gems" type="Control" parent="Center/Control/Map"] margin_left = 1.0 margin_top = 1.0 margin_right = 1.0 margin_bottom = 1.0 -[node name="Control" type="Control" parent="Center/Control/Gems"] +[node name="Control" type="Control" parent="Center/Control/Map/Gems"] margin_right = 16.0 margin_bottom = 16.0 -[node name="Sprite" type="Sprite" parent="Center/Control/Gems/Control"] +[node name="Sprite" type="Sprite" parent="Center/Control/Map/Gems/Control"] modulate = Color( 1, 0.92549, 0.152941, 1 ) material = SubResource( 6 ) position = Vector2( 8, 8 ) texture = ExtResource( 2 ) -[node name="Label" type="Label" parent="Center/Control/Gems"] +[node name="Label" type="Label" parent="Center/Control/Map/Gems"] margin_left = 17.0 margin_top = 3.0 margin_right = 78.0 @@ -153,6 +182,98 @@ custom_fonts/font = SubResource( 8 ) text = "37" valign = 1 +[node name="Stats" type="VBoxContainer" parent="Center/Control"] +margin_left = 4.0 +margin_top = 4.0 +margin_right = 222.0 +margin_bottom = 34.0 +custom_constants/separation = 0 + +[node name="Time" type="HBoxContainer" parent="Center/Control/Stats"] +margin_right = 46.0 +margin_bottom = 10.0 +size_flags_horizontal = 0 +size_flags_vertical = 0 +custom_constants/separation = 2 + +[node name="Image" type="Control" parent="Center/Control/Stats/Time"] +margin_right = 10.0 +margin_bottom = 10.0 +rect_min_size = Vector2( 10, 10 ) + +[node name="Sprite" type="Sprite" parent="Center/Control/Stats/Time/Image"] +material = SubResource( 11 ) +position = Vector2( 5, 5 ) +texture = ExtResource( 9 ) +region_enabled = true +region_rect = Rect2( 15, 7, 10, 10 ) + +[node name="Label" type="Label" parent="Center/Control/Stats/Time"] +margin_left = 12.0 +margin_top = 2.0 +margin_right = 46.0 +margin_bottom = 7.0 +grow_horizontal = 2 +custom_fonts/font = SubResource( 12 ) +text = "56.81" + +[node name="Note" type="HBoxContainer" parent="Center/Control/Stats"] +margin_top = 10.0 +margin_right = 46.0 +margin_bottom = 20.0 +size_flags_horizontal = 0 +size_flags_vertical = 0 +custom_constants/separation = 2 + +[node name="Image" type="Control" parent="Center/Control/Stats/Note"] +margin_right = 10.0 +margin_bottom = 10.0 +rect_min_size = Vector2( 10, 10 ) + +[node name="Sprite" type="Sprite" parent="Center/Control/Stats/Note/Image"] +material = SubResource( 11 ) +position = Vector2( 6, 5 ) +texture = ExtResource( 9 ) +region_enabled = true +region_rect = Rect2( 7, 7, 9, 10 ) + +[node name="Label" type="Label" parent="Center/Control/Stats/Note"] +margin_left = 12.0 +margin_top = 2.0 +margin_right = 46.0 +margin_bottom = 7.0 +grow_horizontal = 2 +custom_fonts/font = SubResource( 12 ) +text = "30:74" + +[node name="Die" type="HBoxContainer" parent="Center/Control/Stats"] +margin_top = 20.0 +margin_right = 25.0 +margin_bottom = 30.0 +size_flags_horizontal = 0 +size_flags_vertical = 0 +custom_constants/separation = 2 + +[node name="Image" type="Control" parent="Center/Control/Stats/Die"] +margin_right = 10.0 +margin_bottom = 10.0 +rect_min_size = Vector2( 10, 10 ) + +[node name="Sprite" type="Sprite" parent="Center/Control/Stats/Die/Image"] +material = SubResource( 9 ) +position = Vector2( 5, 5 ) +texture = ExtResource( 8 ) +region_rect = Rect2( 15, 7, 10, 10 ) + +[node name="Label" type="Label" parent="Center/Control/Stats/Die"] +margin_left = 12.0 +margin_top = 2.0 +margin_right = 25.0 +margin_bottom = 7.0 +grow_horizontal = 2 +custom_fonts/font = SubResource( 10 ) +text = "79" + [node name="Top" type="HBoxContainer" parent="Center/Control"] margin_left = 5.0 margin_top = 5.0 @@ -162,23 +283,20 @@ custom_constants/separation = 0 alignment = 2 [node name="P" type="HBoxContainer" parent="Center/Control/Top"] -margin_left = 181.0 +margin_left = 157.0 margin_right = 218.0 margin_bottom = 12.0 -custom_constants/separation = 2 +custom_constants/separation = 4 -[node name="Key" type="Label" parent="Center/Control/Top/P"] -modulate = Color( 1, 0, 0.301961, 1 ) -margin_right = 11.0 -margin_bottom = 12.0 -custom_fonts/font = SubResource( 4 ) -text = "p" -uppercase = true +[node name="Key" parent="Center/Control/Top/P" instance=ExtResource( 7 )] +margin_top = 1.0 +margin_right = 33.0 +margin_bottom = 10.0 [node name="Desc" type="Label" parent="Center/Control/Top/P"] -margin_left = 13.0 +margin_left = 37.0 margin_top = 3.0 -margin_right = 37.0 -margin_bottom = 9.0 +margin_right = 61.0 +margin_bottom = 8.0 custom_fonts/font = SubResource( 3 ) text = "menu" diff --git a/src/map/2-2.tscn b/src/map/2-2.tscn index 73c7a80..41f7df1 100644 --- a/src/map/2-2.tscn +++ b/src/map/2-2.tscn @@ -98,7 +98,7 @@ 6/name = "crate_tiles.png 6" 6/texture = ExtResource( 11 ) 6/tex_offset = Vector2( 0, 0 ) -6/modulate = Color( 0.670588, 0.321569, 0.211765, 1 ) +6/modulate = Color( 0.678431, 0, 0.156863, 1 ) 6/region = Rect2( 0, 24, 8, 8 ) 6/tile_mode = 0 6/occluder_offset = Vector2( 0, 0 ) @@ -159,7 +159,7 @@ color_grass = Color( 0.741176, 0.580392, 0, 1 ) [node name="SolidTileMap" parent="." instance=ExtResource( 1 )] tile_set = SubResource( 1 ) -tile_data = PoolIntArray( -917514, 1, 0, -917513, 1, 0, -917512, 1, 0, -917511, 1, 0, -917510, 1, 0, -917509, 1, 0, -917508, 1, 0, -917507, 1, 0, -917506, 1, 0, -917505, 1, 0, -983040, 1, 0, -983039, 1, 0, -983038, 1, 0, -983037, 1, 0, -983036, 1, 0, -983035, 1, 0, -983034, 1, 0, -983033, 1, 0, -983032, 1, 0, -983031, 1, 0, -983030, 1, 0, -983029, 1, 0, -983028, 1, 0, -983027, 1, 0, -983026, 1, 0, -983025, 1, 0, -983024, 1, 0, -983023, 1, 0, -983022, 1, 0, -983021, 1, 0, -851978, 1, 0, -917485, 1, 0, -786442, 1, 0, -851949, 1, 0, -720906, 1, 0, -786413, 1, 0, -655370, 1, 0, -720877, 1, 0, -589834, 1, 0, -655341, 1, 0, -524298, 1, 0, -589821, 536870912, 1, -589820, 0, 0, -589819, 0, 1, -589818, 536870912, 0, -589817, 0, 1, -589816, 0, 1, -589815, 0, 0, -589814, 0, 1, -589813, 536870912, 0, -589812, 0, 1, -589811, 536870912, 0, -589810, 536870912, 1, -589805, 1, 0, -458762, 1, 0, -524285, 536870912, 0, -524269, 1, 0, -393226, 1, 0, -393222, 0, 1, -393221, 0, 0, -393220, 0, 1, -393219, 536870912, 0, -393218, 0, 1, -393217, 0, 0, -458752, 0, 1, -458751, 0, 1, -458750, 536870912, 0, -458749, 536870912, 1, -458733, 1, 0, -327690, 1, 0, -327686, 0, 0, -393202, 536870912, 0, -393197, 1, 0, -262154, 1, 0, -262150, 0, 1, -327666, 536870912, 1, -327665, 0, 0, -327664, 0, 1, -327663, 536870912, 0, -327662, 1, 0, -327661, 1, 0, -196618, 1, 0, -196617, 1, 0, -196616, 0, 0, -196615, 0, 1, -196614, 536870912, 0, -262127, 0, 1, -131080, 0, 1, -196591, 0, 0, -65544, 536870912, 0, -131068, 536870912, 0, -131067, 0, 1, -131066, 0, 0, -131059, 0, 1, -131058, 0, 0, -131057, 0, 1, -131056, 536870912, 0, -131055, 0, 1, -8, 0, 1, -65532, 0, 1, -65530, 0, 1, -65523, 0, 0, 65528, 0, 0, 65529, 0, 1, 65530, 536870912, 0, 65531, 0, 1, 1, 0, 1, 2, 0, 0, 3, 0, 1, 4, 536870912, 0, 6, 536870912, 0, 13, 0, 1, 131067, 0, 0, 65537, 0, 0, 65542, 0, 1, 65549, 536870912, 0, 196603, 0, 1, 131073, 0, 1, 131078, 0, 0, 131079, 0, 1, 131080, 536870912, 0, 131081, 0, 1, 131082, 0, 0, 131083, 0, 1, 131084, 536870912, 0, 131085, 536870912, 1, 262139, 0, 0, 262140, 0, 1, 262141, 0, 0, 262142, 0, 1, 262143, 536870912, 0, 196608, 0, 1, 196609, 0, 0 ) +tile_data = PoolIntArray( -917514, 1, 0, -917513, 1, 0, -917512, 1, 0, -917511, 1, 0, -917510, 1, 0, -917509, 1, 0, -917508, 1, 0, -917507, 1, 0, -917506, 1, 0, -917505, 1, 0, -983040, 1, 0, -983039, 1, 0, -983038, 1, 0, -983037, 1, 0, -983036, 1, 0, -983035, 1, 0, -983034, 1, 0, -983033, 1, 0, -983032, 1, 0, -983031, 1, 0, -983030, 1, 0, -983029, 1, 0, -983028, 1, 0, -983027, 1, 0, -983026, 1, 0, -983025, 1, 0, -983024, 1, 0, -983023, 1, 0, -983022, 1, 0, -983021, 1, 0, -851978, 1, 0, -917485, 1, 0, -786442, 1, 0, -851949, 1, 0, -720906, 1, 0, -786413, 1, 0, -655370, 1, 0, -720877, 1, 0, -589834, 1, 0, -655341, 1, 0, -524298, 1, 0, -589821, 536870912, 1, -589820, 0, 0, -589819, 0, 1, -589818, 536870912, 0, -589817, 0, 1, -589816, 0, 1, -589815, 0, 0, -589814, 0, 1, -589813, 536870912, 0, -589812, 0, 1, -589811, 536870912, 0, -589810, 536870912, 1, -589805, 1, 0, -458762, 1, 0, -524285, 536870912, 0, -524269, 1, 0, -393226, 1, 0, -393222, 0, 1, -393221, 0, 0, -393220, 0, 1, -393219, 536870912, 0, -393218, 0, 1, -393217, 0, 0, -458752, 0, 1, -458751, 0, 1, -458750, 536870912, 0, -458749, 536870912, 1, -458733, 1, 0, -327690, 1, 0, -327686, 0, 0, -393197, 1, 0, -262154, 1, 0, -262150, 0, 1, -327666, 536870912, 1, -327665, 0, 0, -327664, 0, 1, -327663, 536870912, 0, -327662, 1, 0, -327661, 1, 0, -196618, 1, 0, -196617, 1, 0, -196616, 0, 0, -196615, 0, 1, -196614, 536870912, 0, -262127, 0, 1, -131080, 0, 1, -196591, 0, 0, -65544, 536870912, 0, -131068, 536870912, 0, -131067, 0, 1, -131066, 0, 0, -131059, 0, 1, -131058, 0, 0, -131057, 0, 1, -131056, 536870912, 0, -131055, 0, 1, -8, 0, 1, -65532, 0, 1, -65530, 0, 1, -65523, 0, 0, 65528, 0, 0, 65529, 0, 1, 65530, 536870912, 0, 65531, 0, 1, 1, 0, 1, 2, 0, 0, 3, 0, 1, 4, 536870912, 0, 6, 536870912, 0, 13, 0, 1, 131067, 0, 0, 65537, 0, 0, 65542, 0, 1, 65549, 536870912, 0, 196603, 0, 1, 131073, 0, 1, 131078, 0, 0, 131079, 0, 1, 131080, 536870912, 0, 131081, 0, 1, 131082, 0, 0, 131083, 0, 1, 131084, 536870912, 0, 131085, 536870912, 1, 262139, 0, 0, 262140, 0, 1, 262141, 0, 0, 262142, 0, 1, 262143, 536870912, 0, 196608, 0, 1, 196609, 0, 0 ) tile_color = Color( 0.768627, 0.407843, 0.454902, 1 ) [node name="SpikeTileMap" parent="." instance=ExtResource( 5 )] @@ -174,7 +174,7 @@ grass_color = Color( 0.741176, 0.580392, 0, 1 ) [node name="ObscureMap" parent="." instance=ExtResource( 9 )] tile_set = SubResource( 3 ) -tile_data = PoolIntArray( -851977, 536870912, 0, -851976, 536870912, 0, -851975, 536870912, 0, -851974, 536870912, 0, -851973, 536870912, 0, -851972, 536870912, 0, -851971, 536870912, 0, -851970, 536870912, 0, -851969, 536870912, 0, -917504, 536870912, 0, -917503, 536870912, 0, -917502, 536870912, 0, -917501, 536870912, 0, -917500, 536870912, 0, -917499, 536870912, 0, -917498, 536870912, 0, -917497, 536870912, 0, -917496, 536870912, 0, -917495, 536870912, 0, -917494, 536870912, 0, -917493, 536870912, 0, -917492, 536870912, 0, -917491, 536870912, 0, -917490, 536870912, 0, -917489, 536870912, 0, -917488, 536870912, 0, -917487, 536870912, 0, -917486, 536870912, 0, -786441, 536870912, 0, -786440, 536870912, 0, -786439, 536870912, 0, -786438, 536870912, 0, -786437, 536870912, 0, -786436, 536870912, 0, -786435, 536870912, 0, -786434, 536870912, 0, -786433, 536870912, 0, -851968, 536870912, 0, -851967, 536870912, 0, -851966, 536870912, 0, -851965, 536870912, 0, -851964, 536870912, 0, -851963, 536870912, 0, -851962, 536870912, 0, -851961, 536870912, 0, -851960, 536870912, 0, -851959, 536870912, 0, -851958, 536870912, 0, -851957, 536870912, 0, -851956, 536870912, 0, -851955, 536870912, 0, -851954, 536870912, 0, -851953, 536870912, 0, -851952, 536870912, 0, -851951, 536870912, 0, -851950, 536870912, 0, -720905, 536870912, 0, -720904, 536870912, 0, -720903, 536870912, 0, -720902, 536870912, 0, -720901, 536870912, 0, -720900, 536870912, 0, -720899, 536870912, 0, -720898, 536870912, 0, -720897, 536870912, 0, -786432, 536870912, 0, -786431, 536870912, 0, -786430, 536870912, 0, -786429, 536870912, 0, -786428, 536870912, 0, -786427, 536870912, 0, -786426, 536870912, 0, -786425, 536870912, 0, -786424, 536870912, 0, -786423, 536870912, 0, -786422, 536870912, 0, -786421, 536870912, 0, -786420, 536870912, 0, -786419, 536870912, 0, -786418, 536870912, 0, -786417, 536870912, 0, -786416, 536870912, 0, -786415, 536870912, 0, -786414, 536870912, 0, -655369, 536870912, 0, -655368, 536870912, 0, -655367, 536870912, 0, -655366, 536870912, 0, -655365, 536870912, 0, -655364, 536870912, 0, -655363, 536870912, 0, -655362, 536870912, 0, -655361, 536870912, 0, -720896, 536870912, 0, -720895, 536870912, 0, -720894, 536870912, 0, -720893, 536870912, 0, -720892, 536870912, 0, -720891, 536870912, 0, -720890, 536870912, 0, -720889, 536870912, 0, -720888, 536870912, 0, -720887, 536870912, 0, -720886, 536870912, 0, -720885, 536870912, 0, -720884, 536870912, 0, -720883, 536870912, 0, -720882, 536870912, 0, -720881, 536870912, 0, -720880, 536870912, 0, -720879, 536870912, 0, -720878, 536870912, 0, -589833, 536870912, 0, -589832, 536870912, 0, -589831, 536870912, 0, -589830, 536870912, 0, -589829, 536870912, 0, -589828, 536870912, 0, -589827, 536870912, 0, -589826, 536870912, 0, -589825, 536870912, 0, -655360, 536870912, 0, -655359, 536870912, 0, -655358, 536870912, 0, -655357, 536870912, 0, -655356, 536870912, 0, -655355, 536870912, 0, -655354, 536870912, 0, -655353, 536870912, 0, -655352, 536870912, 0, -655351, 536870912, 0, -655350, 536870912, 0, -655349, 536870912, 0, -655348, 536870912, 0, -655347, 536870912, 0, -655346, 536870912, 0, -655345, 536870912, 0, -655344, 536870912, 0, -655343, 536870912, 0, -655342, 536870912, 0, -524297, 536870912, 0, -524296, 536870912, 0, -524295, 536870912, 0, -524294, 536870912, 0, -524293, 536870912, 0, -524292, 536870912, 0, -524291, 536870912, 0, -524290, 536870912, 0, -524289, 536870912, 0, -589824, 536870912, 0, -589823, 536870912, 0, -589822, 536870912, 0, -589809, 536870912, 0, -589808, 536870912, 0, -589807, 536870912, 0, -589806, 536870912, 0, -458761, 536870912, 0, -458760, 536870912, 0, -458759, 536870912, 0, -458758, 536870912, 0, -458757, 536870912, 0, -458756, 536870912, 0, -458755, 536870912, 0, -458754, 536870912, 0, -458753, 536870912, 0, -524288, 536870912, 0, -524287, 536870912, 0, -524286, 536870912, 0, -524274, 2, 2, -524273, 536870912, 0, -524272, 536870912, 0, -524271, 536870912, 0, -524270, 536870912, 0, -393225, 536870912, 0, -393224, 536870912, 0, -393223, 536870912, 0, -458738, 536870914, 3, -458737, 536870912, 0, -458736, 536870912, 0, -458735, 536870912, 0, -458734, 536870912, 0, -327689, 536870912, 0, -327688, 536870912, 0, -327687, 536870912, 0, -393201, 536870912, 0, -393200, 536870912, 0, -393199, 536870912, 0, -393198, 536870912, 0, -262153, 536870912, 0, -262152, 536870912, 0, -262151, 536870912, 0 ) +tile_data = PoolIntArray( -851977, 536870912, 0, -851976, 536870912, 0, -851975, 536870912, 0, -851974, 536870912, 0, -851973, 536870912, 0, -851972, 536870912, 0, -851971, 536870912, 0, -851970, 536870912, 0, -851969, 536870912, 0, -917504, 536870912, 0, -917503, 536870912, 0, -917502, 536870912, 0, -917501, 536870912, 0, -917500, 536870912, 0, -917499, 536870912, 0, -917498, 536870912, 0, -917497, 536870912, 0, -917496, 536870912, 0, -917495, 536870912, 0, -917494, 536870912, 0, -917493, 536870912, 0, -917492, 536870912, 0, -917491, 536870912, 0, -917490, 536870912, 0, -917489, 536870912, 0, -917488, 536870912, 0, -917487, 536870912, 0, -917486, 536870912, 0, -786441, 536870912, 0, -786440, 536870912, 0, -786439, 536870912, 0, -786438, 536870912, 0, -786437, 536870912, 0, -786436, 536870912, 0, -786435, 536870912, 0, -786434, 536870912, 0, -786433, 536870912, 0, -851968, 536870912, 0, -851967, 536870912, 0, -851966, 536870912, 0, -851965, 536870912, 0, -851964, 536870912, 0, -851963, 536870912, 0, -851962, 536870912, 0, -851961, 536870912, 0, -851960, 536870912, 0, -851959, 536870912, 0, -851958, 536870912, 0, -851957, 536870912, 0, -851956, 536870912, 0, -851955, 536870912, 0, -851954, 536870912, 0, -851953, 536870912, 0, -851952, 536870912, 0, -851951, 536870912, 0, -851950, 536870912, 0, -720905, 536870912, 0, -720904, 536870912, 0, -720903, 536870912, 0, -720902, 536870912, 0, -720901, 536870912, 0, -720900, 536870912, 0, -720899, 536870912, 0, -720898, 536870912, 0, -720897, 536870912, 0, -786432, 536870912, 0, -786431, 536870912, 0, -786430, 536870912, 0, -786429, 536870912, 0, -786428, 536870912, 0, -786427, 536870912, 0, -786426, 536870912, 0, -786425, 536870912, 0, -786424, 536870912, 0, -786423, 536870912, 0, -786422, 536870912, 0, -786421, 536870912, 0, -786420, 536870912, 0, -786419, 536870912, 0, -786418, 536870912, 0, -786417, 536870912, 0, -786416, 536870912, 0, -786415, 536870912, 0, -786414, 536870912, 0, -655369, 536870912, 0, -655368, 536870912, 0, -655367, 536870912, 0, -655366, 536870912, 0, -655365, 536870912, 0, -655364, 536870912, 0, -655363, 536870912, 0, -655362, 536870912, 0, -655361, 536870912, 0, -720896, 536870912, 0, -720895, 536870912, 0, -720894, 536870912, 0, -720893, 536870912, 0, -720892, 536870912, 0, -720891, 536870912, 0, -720890, 536870912, 0, -720889, 536870912, 0, -720888, 536870912, 0, -720887, 536870912, 0, -720886, 536870912, 0, -720885, 536870912, 0, -720884, 536870912, 0, -720883, 536870912, 0, -720882, 536870912, 0, -720881, 536870912, 0, -720880, 536870912, 0, -720879, 536870912, 0, -720878, 536870912, 0, -589833, 536870912, 0, -589832, 536870912, 0, -589831, 536870912, 0, -589830, 536870912, 0, -589829, 536870912, 0, -589828, 536870912, 0, -589827, 536870912, 0, -589826, 536870912, 0, -589825, 536870912, 0, -655360, 536870912, 0, -655359, 536870912, 0, -655358, 536870912, 0, -655357, 536870912, 0, -655356, 536870912, 0, -655355, 536870912, 0, -655354, 536870912, 0, -655353, 536870912, 0, -655352, 536870912, 0, -655351, 536870912, 0, -655350, 536870912, 0, -655349, 536870912, 0, -655348, 536870912, 0, -655347, 536870912, 0, -655346, 536870912, 0, -655345, 536870912, 0, -655344, 536870912, 0, -655343, 536870912, 0, -655342, 536870912, 0, -524297, 536870912, 0, -524296, 536870912, 0, -524295, 536870912, 0, -524294, 536870912, 0, -524293, 536870912, 0, -524292, 536870912, 0, -524291, 536870912, 0, -524290, 536870912, 0, -524289, 536870912, 0, -589824, 536870912, 0, -589823, 536870912, 0, -589822, 536870912, 0, -589809, 536870912, 0, -589808, 536870912, 0, -589807, 536870912, 0, -589806, 536870912, 0, -458761, 536870912, 0, -458760, 536870912, 0, -458759, 536870912, 0, -458758, 536870912, 0, -458757, 536870912, 0, -458756, 536870912, 0, -458755, 536870912, 0, -458754, 536870912, 0, -458753, 536870912, 0, -524288, 536870912, 0, -524287, 536870912, 0, -524286, 536870912, 0, -524274, 536870914, 2, -524273, 536870912, 0, -524272, 536870912, 0, -524271, 536870912, 0, -524270, 536870912, 0, -393225, 536870912, 0, -393224, 536870912, 0, -393223, 536870912, 0, -458738, 2, 3, -458737, 536870912, 0, -458736, 536870912, 0, -458735, 536870912, 0, -458734, 536870912, 0, -327689, 536870912, 0, -327688, 536870912, 0, -327687, 536870912, 0, -393202, 536870914, 2, -393201, 536870912, 0, -393200, 536870912, 0, -393199, 536870912, 0, -393198, 536870912, 0, -262153, 536870912, 0, -262152, 536870912, 0, -262151, 536870912, 0 ) tile_color = Color( 0.768627, 0.407843, 0.454902, 1 ) [node name="GameCamera" parent="." instance=ExtResource( 3 )] @@ -192,6 +192,6 @@ position = Vector2( 125, -27 ) position = Vector2( -51, -8 ) [node name="Note" parent="Actors" instance=ExtResource( 10 )] -position = Vector2( -5, -77 ) +position = Vector2( -61, -77 ) [editable path="GameCamera"] diff --git a/src/menu/StartMenu.gd b/src/menu/StartMenu.gd index d56dc7c..9577978 100644 --- a/src/menu/StartMenu.gd +++ b/src/menu/StartMenu.gd @@ -32,6 +32,9 @@ export var cursor_expand := Vector2.ZERO export var color_select := Color.white export var color_deselect := Color(1,1,1, 0.7) +var switch_clock := 0.0 +export var switch_cooldown := 0.1 + func _ready(): randomize() Player.set_palette(demo_player_mat, Shared.pick_player_colors()) @@ -72,7 +75,7 @@ func setup_slots(): Player.set_palette(player_mat, sd["player_colors"]) func _input(event): - if !is_input or Wipe.is_wipe: return + if !is_input or Wipe.is_wipe or switch_clock > 0.0: return if event.is_action_pressed("action"): if menu_items == open_items: @@ -92,6 +95,9 @@ func _input(event): self.cursor += -1 if up else 1 Audio.play("menu_scroll", 0.8, 1.2) +func _physics_process(delta): + switch_clock = max(0, switch_clock - delta) + func write_menu(): yield(get_tree(), "idle_frame") cursor_node.rect_global_position = menu_stuff[cursor].rect_global_position + cursor_offset @@ -158,6 +164,7 @@ func switch_menu(arg, silent := false, _cursor := 0): x = i if x > -1: + switch_clock = switch_cooldown menu_items = items[x] menu_stuff = node[x].get_children() diff --git a/src/menu/StartMenu.tscn b/src/menu/StartMenu.tscn index ff9b030..9a3c345 100644 --- a/src/menu/StartMenu.tscn +++ b/src/menu/StartMenu.tscn @@ -273,6 +273,7 @@ demo_player_path = NodePath("Stage/Actors/Player") cursor_offset = Vector2( -2, 0 ) cursor_expand = Vector2( 4, 0 ) color_deselect = Color( 0.8, 0.8, 0.8, 1 ) +switch_cooldown = 0.13 [node name="Control" type="Control" parent="."] margin_left = -24.0 diff --git a/src/menu/options/Key.gd b/src/menu/options/Key.gd new file mode 100644 index 0000000..2fac2f0 --- /dev/null +++ b/src/menu/options/Key.gd @@ -0,0 +1,29 @@ +tool +extends Control + +export var text := "key" setget set_text + +onready var white := $White +onready var black := $Black +onready var label := $Label + +func _ready(): + set_text() + if Engine.editor_hint: return + +func set_text(arg := text): + text = arg + var l = text.length() * 6.0 + + rect_min_size = Vector2(l + 3, 9) + + if is_instance_valid(label): + label.text = text + label.rect_size = Vector2.ONE + + if is_instance_valid(white): + white.rect_size = rect_min_size + if is_instance_valid(black): + black.rect_size = Vector2(l + 1, 7) + + update() diff --git a/src/menu/options/Key.tscn b/src/menu/options/Key.tscn new file mode 100644 index 0000000..1de51a4 --- /dev/null +++ b/src/menu/options/Key.tscn @@ -0,0 +1,41 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://media/font/QuinqueFive.ttf" type="DynamicFontData" id=1] +[ext_resource path="res://src/menu/options/Key.gd" type="Script" id=2] + +[sub_resource type="DynamicFont" id=1] +size = 5 +outline_size = 1 +outline_color = Color( 0, 0, 0, 1 ) +extra_spacing_top = -1 +extra_spacing_bottom = -1 +font_data = ExtResource( 1 ) + +[node name="Key" type="Control"] +margin_right = 8.0 +margin_bottom = 8.0 +rect_min_size = Vector2( 33, 9 ) +size_flags_vertical = 4 +script = ExtResource( 2 ) +text = "enter" + +[node name="White" type="ColorRect" parent="."] +margin_right = 33.0 +margin_bottom = 9.0 +rect_min_size = Vector2( 8, 8 ) + +[node name="Black" type="ColorRect" parent="."] +modulate = Color( 0, 0, 0, 1 ) +margin_left = 1.0 +margin_top = 1.0 +margin_right = 32.0 +margin_bottom = 8.0 +rect_min_size = Vector2( 7, 7 ) + +[node name="Label" type="Label" parent="."] +margin_left = 2.0 +margin_top = 2.0 +margin_right = 26.0 +margin_bottom = 7.0 +custom_fonts/font = SubResource( 1 ) +text = "enter" diff --git a/src/menu/select.gd b/src/menu/select.gd index 6707ace..b7be447 100644 --- a/src/menu/select.gd +++ b/src/menu/select.gd @@ -172,7 +172,7 @@ func make_screen(i := 0): var has_note = s.has("note") new.get_node("Overlay/Notes").visible = has_note if has_note: - new.get_node("Overlay/Notes/Label").text = time_to_string(s["note"]) + new.get_node("Overlay/Notes/Label").text = Shared.time_to_string(s["note"]) var has_time = s.has("time") new.get_node("Overlay/Time").visible = has_time @@ -180,7 +180,7 @@ func make_screen(i := 0): gem.modulate = color_gem if has_time else color_new gem.visible = !is_locked if has_time: - new.get_node("Overlay/Time/Label").text = time_to_string(s["time"]) + new.get_node("Overlay/Time/Label").text = Shared.time_to_string(s["time"]) var has_die = s.has("die") new.get_node("Overlay/Death").visible = has_die @@ -252,7 +252,7 @@ func write_score(): t = "no data!" else: for i in s: - t += time_to_string(-int(i["score"])) + " " + str(i["player_name"]) + "\n" + t += Shared.time_to_string(-int(i["score"])) + " " + str(i["player_name"]) + "\n" count += 1 if count > 9 : break else: @@ -261,7 +261,7 @@ func write_score(): if Shared.replays.has(map_name): for i in Shared.replays[map_name]: if i.has("frames"): - t += time_to_string(int(i["frames"])) + "\n" + t += Shared.time_to_string(int(i["frames"])) + "\n" count += 1 if count > 9 : break else: @@ -269,13 +269,6 @@ func write_score(): score_list.text = t -func time_to_string(arg := 0.0): - var time = arg * (1.0/60.0) - if time < 60.0: - return str(time).pad_decimals(2) - else: - return str(time / 60.0).pad_zeros(2).pad_decimals(0) + ":" + str(fposmod(time, 60.0)).pad_zeros(2).pad_decimals(0) - func open_map(): if current_map in map_unlocked: Shared.map_select = cursor