diff --git a/media/image/keymap.png b/media/image/keymap.png index 6943339..c5b3023 100644 Binary files a/media/image/keymap.png and b/media/image/keymap.png differ diff --git a/project.godot b/project.godot index b4ba099..5ad3526 100644 --- a/project.godot +++ b/project.godot @@ -190,24 +190,36 @@ ui_left={ "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":65,"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":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":4,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":6,"axis_value":1.0,"script":null) ] } ui_right={ "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":68,"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":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":5,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":7,"axis_value":1.0,"script":null) ] } ui_up={ "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":87,"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":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null) ] } ui_down={ "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":83,"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":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null) ] } ui_page_up={ @@ -230,7 +242,6 @@ ui_pause={ "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":16777217,"physical_scancode":0,"unicode":0,"echo":false,"script":null) , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":11,"pressure":0.0,"pressed":false,"script":null) -, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":10,"pressure":0.0,"pressed":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":80,"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":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null) ] @@ -240,6 +251,9 @@ ui_yes={ "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":75,"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":32,"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":88,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":3,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":9,"pressure":0.0,"pressed":false,"script":null) ] } ui_no={ @@ -247,11 +261,15 @@ ui_no={ "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":74,"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":16777238,"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":67,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":2,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":8,"pressure":0.0,"pressed":false,"script":null) ] } ui_del={ "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":16777224,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":10,"pressure":0.0,"pressed":false,"script":null) ] } up={ @@ -260,6 +278,7 @@ up={ , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"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":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":3,"axis_value":-1.0,"script":null) ] } down={ @@ -268,6 +287,7 @@ down={ , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"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":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":3,"axis_value":1.0,"script":null) ] } left={ @@ -276,6 +296,7 @@ left={ , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"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":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":2,"axis_value":-1.0,"script":null) ] } right={ @@ -284,6 +305,7 @@ right={ , Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"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":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":2,"axis_value":1.0,"script":null) ] } jump={ diff --git a/src/autoload/Pause.gd b/src/autoload/Pause.gd index 283cc91..70391be 100644 --- a/src/autoload/Pause.gd +++ b/src/autoload/Pause.gd @@ -8,20 +8,17 @@ var clock := 0.0 signal pause signal unpause -func _physics_process(delta): - if clock != 0: - clock = max(0, clock - delta) - if clock == 0: - if is_paused: - pass - else: - get_tree().paused = false - func _input(event): if clock == 0 and Shared.is_in_game and !Wipe.is_wipe: if event.is_action_pressed("ui_pause"): toggle_pause() +func _physics_process(delta): + if clock != 0: + clock = max(0, clock - delta) + if clock == 0 and !is_paused: + get_tree().paused = false + func toggle_pause(): is_paused = !is_paused open(is_paused) @@ -33,7 +30,6 @@ func toggle_pause(): if is_paused: get_tree().paused = is_paused - set_cursor() emit_signal("pause") Audio.play("menu_pause", 0.9, 1.1) else: @@ -52,6 +48,8 @@ func btn_yes(): toggle_pause() Audio.play("menu_reset", 0.9, 1.1) 2: + open_sub(OptionsMenu) + 3: Shared.wipe_scene(Shared.level_select_path) toggle_pause() Audio.play("menu_exit", 0.9, 1.1) diff --git a/src/autoload/Pause.tscn b/src/autoload/Pause.tscn index 4be8c43..f4ac69b 100644 --- a/src/autoload/Pause.tscn +++ b/src/autoload/Pause.tscn @@ -55,9 +55,9 @@ anchor_bottom = 1.0 [node name="VBox" type="VBoxContainer" parent="Control/Center"] margin_left = 54.0 -margin_top = 29.0 +margin_top = 21.0 margin_right = 174.0 -margin_bottom = 98.0 +margin_bottom = 106.0 custom_constants/separation = 8 alignment = 1 @@ -70,17 +70,17 @@ align = 1 valign = 2 [node name="List" type="VBoxContainer" parent="Control/Center/VBox"] -margin_left = 44.0 +margin_left = 36.0 margin_top = 29.0 -margin_right = 76.0 -margin_bottom = 69.0 +margin_right = 84.0 +margin_bottom = 85.0 size_flags_horizontal = 4 custom_constants/separation = 8 alignment = 1 [node name="Label" type="Label" parent="Control/Center/VBox/List"] -margin_left = 8.0 -margin_right = 24.0 +margin_left = 16.0 +margin_right = 32.0 margin_bottom = 8.0 size_flags_horizontal = 4 custom_fonts/font = SubResource( 4 ) @@ -88,20 +88,30 @@ text = "go" uppercase = true [node name="Label2" type="Label" parent="Control/Center/VBox/List"] +margin_left = 8.0 margin_top = 16.0 -margin_right = 32.0 +margin_right = 40.0 margin_bottom = 24.0 size_flags_horizontal = 4 custom_fonts/font = SubResource( 4 ) text = "redo" uppercase = true -[node name="Label3" type="Label" parent="Control/Center/VBox/List"] -margin_left = 4.0 +[node name="Label4" type="Label" parent="Control/Center/VBox/List"] margin_top = 32.0 -margin_right = 28.0 +margin_right = 48.0 margin_bottom = 40.0 size_flags_horizontal = 4 custom_fonts/font = SubResource( 4 ) +text = "option" +uppercase = true + +[node name="Label3" type="Label" parent="Control/Center/VBox/List"] +margin_left = 12.0 +margin_top = 48.0 +margin_right = 36.0 +margin_bottom = 56.0 +size_flags_horizontal = 4 +custom_fonts/font = SubResource( 4 ) text = "map" uppercase = true diff --git a/src/menu/Menu.gd b/src/menu/Menu.gd index 3244daf..4eb2e8a 100644 --- a/src/menu/Menu.gd +++ b/src/menu/Menu.gd @@ -2,6 +2,7 @@ extends Node class_name Menu export var is_open = false +export var is_sub := false export var parent_path : NodePath = "" onready var parent_node = get_node_or_null(parent_path) @@ -16,6 +17,7 @@ export var cursor := 0 setget set_cursor export var cursor_expand := Vector2.ZERO export var cursor_lerp := 0.2 export var is_audio_scroll = false +export var is_sub_visible := false export var scroll_path : NodePath = "" onready var scroll_node : Control = get_node_or_null(scroll_path) @@ -52,7 +54,7 @@ func make_list(arg): list = arg.get_children() func menu_input(event): - if !is_open or open_clock > 0 or Wipe.is_wipe: return + if !is_open or is_sub or open_clock > 0 or Wipe.is_wipe: return var b_del : bool = event.is_action_pressed("ui_del") var b_pause : bool = event.is_action_pressed("ui_pause") @@ -121,8 +123,9 @@ func open(arg := false, _last = null): if is_open: set_cursor(0) UI.keys(ui_expand, ui_top, ui_arrows, ui_x, ui_c, ui_stack, ui_v) - elif is_instance_valid(last_menu) and last_menu.has_method("resume"): - last_menu.resume() + elif is_instance_valid(last_menu): + last_menu.close_sub() + last_menu = null open_clock = open_time @@ -130,3 +133,22 @@ func open(arg := false, _last = null): func on_open(): pass + +func open_sub(arg : Menu): + if is_instance_valid(arg): + is_sub = true + arg.open(true, self) + parent_node.visible = is_sub_visible + on_open_sub() + +func on_open_sub(): + pass + +func close_sub(): + is_sub = false + parent_node.visible = true + open_clock = open_time + on_close_sub() + +func on_close_sub(): + pass diff --git a/src/menu/StartMenu.gd b/src/menu/StartMenu.gd index 8d29795..f612b08 100644 --- a/src/menu/StartMenu.gd +++ b/src/menu/StartMenu.gd @@ -24,7 +24,6 @@ var erase_items := ["really erase", "no erase"] var menu_name := "main" var menu_last := menu_name -var is_input = true export var is_credits := false func _ready(): @@ -40,14 +39,11 @@ func _ready(): open(true) -func menu_input(event): - if is_input: .menu_input(event) - func btn_no(): if is_credits: is_credits = false credits_node.visible = false - resume() + close_sub() else: if menu_items == open_items: Player.set_palette(demo_player_mat, Shared.pick_player_colors()) @@ -103,12 +99,9 @@ func menu_select(tag : String = menu_items[cursor].to_lower()): Shared.wipe_scene(Shared.creator_path) Audio.play("menu_play", 0.9, 1.1) "options": - OptionsMenu.open(true, self) - is_input = false + open_sub(OptionsMenu) Audio.play("menu_options", 0.9, 1.1) Shared.cam.pos_target += Vector2(24, -4) - if parent_node: - parent_node.visible = false "credits": is_credits = true credits_node.visible = true @@ -150,13 +143,10 @@ func menu_select(tag : String = menu_items[cursor].to_lower()): switch_menu("open") -func resume(): - is_input = true +func on_close_sub(): open_clock = open_time Shared.cam.pos_target = Vector2(90, 76) UI.keys(false) - if parent_node: - parent_node.visible = true func switch_menu(arg, silent := false, _cursor := 0): var s = ["quit", "main", "slot", "open", "erase"] diff --git a/src/menu/StartMenu.tscn b/src/menu/StartMenu.tscn index f72c68a..36d9fab 100644 --- a/src/menu/StartMenu.tscn +++ b/src/menu/StartMenu.tscn @@ -159,7 +159,7 @@ shader_param/skin_swap = Color( 1, 0.843137, 0, 1 ) shader_param/suit_swap = Color( 0, 0.71875, 1, 1 ) shader_param/shoe_swap = Color( 0, 0.0862745, 1, 1 ) -[sub_resource type="DynamicFont" id=4] +[sub_resource type="DynamicFont" id=20] size = 48 extra_spacing_top = -11 extra_spacing_bottom = -12 @@ -801,7 +801,7 @@ margin_top = 5.0 margin_right = 228.0 margin_bottom = 26.0 rect_min_size = Vector2( 228, 0 ) -custom_fonts/font = SubResource( 4 ) +custom_fonts/font = SubResource( 20 ) text = "Tiny Crate" align = 1 diff --git a/src/menu/options/Key.gd b/src/menu/options/Key.gd index e30de3e..7b915ac 100644 --- a/src/menu/options/Key.gd +++ b/src/menu/options/Key.gd @@ -34,13 +34,40 @@ var swap := {"control" : "ctrl", "pagedown" : "pgdn", "scrolllock" : "scrlk", "backspace" : "back", +"joy 4" : "lb", +"joy 5" : "rb", +"joy 6" : "lt", +"axis 6+" : "lt", +"joy 7" : "rt", +"axis 7+" : "rt", } var images := {"up" : 0, "down" : 1, "left" : 2, "right" : 3, -"," : 4} +"," : 4, +"joy 0" : 8, +"joy 1" : 9, +"joy 2" : 10, +"joy 3" : 11, +"joy 12" : 12, +"joy 13" : 13, +"joy 14" : 14, +"joy 15" : 15, +"axis 1-" : 16, +"axis 1+" : 17, +"axis 0-" : 18, +"axis 0+" : 19, +"axis 3-" : 20, +"axis 3+" : 21, +"axis 2-" : 22, +"axis 2+" : 23, +"joy 10" : 24, +"joy 11" : 25, +"joy 8" : 26, +"joy 9" : 27, +} func _ready(): @@ -55,13 +82,16 @@ func refresh(): func set_text(arg := text): text = arg.to_lower() + print(text) var frame = -1 + if swap.has(text): text = swap[text] if images.has(text): frame = images[text] + var is_joy = frame > 7 var l = (text.length() if frame < 0 else 1) * font_width @@ -79,8 +109,10 @@ func set_text(arg := text): label.text = text if frame < 0 else "" label.rect_size = Vector2.ONE if is_instance_valid(white): + white.visible = !is_joy white.rect_size = in_size if is_instance_valid(black): + black.visible = !is_joy black.rect_size = out_size update() @@ -108,5 +140,14 @@ static func is_type(event, _is_gamepad := is_gamepad): return test func parse_event(event : InputEvent): - self.text = str(event.as_text()) + var s = " " + if event is InputEventJoypadButton: + s = "JOY " + str(event.button_index) + elif event is InputEventJoypadMotion: + var sgn = "+" if event.axis_value > 0 else "-" + s = "AXIS " + str(event.axis) + sgn + elif event is InputEvent: + s = str(event.as_text().to_lower()) + + self.text = s update() diff --git a/src/menu/options/Key.tscn b/src/menu/options/Key.tscn index bbf0f01..39fae63 100644 --- a/src/menu/options/Key.tscn +++ b/src/menu/options/Key.tscn @@ -32,17 +32,18 @@ margin_right = 7.0 margin_bottom = 7.0 [node name="Label" type="Label" parent="."] +visible = false modulate = Color( 0, 0, 0, 1 ) margin_left = 1.0 margin_top = 1.0 -margin_right = 19.0 +margin_right = 2.0 margin_bottom = 6.0 custom_fonts/font = SubResource( 1 ) [node name="Sprite" type="Sprite" parent="."] -modulate = Color( 0, 0, 0, 1 ) +position = Vector2( -1, -1 ) texture = ExtResource( 3 ) centered = false hframes = 4 -vframes = 4 +vframes = 8 frame = 2 diff --git a/src/menu/options/KeyMenu.gd b/src/menu/options/KeyMenu.gd index 8730f77..922890c 100644 --- a/src/menu/options/KeyMenu.gd +++ b/src/menu/options/KeyMenu.gd @@ -11,6 +11,8 @@ export var row_path : NodePath = "" onready var row_dupe := get_node_or_null(row_path).duplicate() export var label_path : NodePath = "" onready var label_dupe := get_node_or_null(label_path).duplicate() +export var header_path : NodePath = "" +onready var header_node := get_node_or_null(header_path) var actions := [] @@ -99,7 +101,6 @@ func menu_input(event): Audio.play("menu_scroll", 0.8, 1.2) elif is_no: open(false) - OptionsMenu.open(true) elif is_yes: if is_action: popup.visible = true @@ -119,20 +120,20 @@ func on_open(): if is_open: ui_keys() UI.labels() + if is_instance_valid(header_node): + header_node.text = "gamepad" if is_gamepad else "keyboard" + for i in actions.size(): + fill_row(list[i], actions[i]) func fill_row(row, action): var a = get_action_list_is_type(action) - var k := [] - - for y in a: - k.append(y.as_text()) var keys = row.get_node("Keys").get_children() for x in keys.size(): - var less = x < k.size() + var less = x < a.size() keys[x].visible = less if less: - keys[x].text = k[x] + keys[x].parse_event(a[x]) func get_action_list_is_type(_action, _gamepad := is_gamepad): var e = [] diff --git a/src/menu/options/KeyMenu.tscn b/src/menu/options/KeyMenu.tscn index b6a3e21..c0f4081 100644 --- a/src/menu/options/KeyMenu.tscn +++ b/src/menu/options/KeyMenu.tscn @@ -1,18 +1,31 @@ -[gd_scene load_steps=6 format=2] +[gd_scene load_steps=9 format=2] [ext_resource path="res://media/font/QuinqueFive.ttf" type="DynamicFontData" id=1] [ext_resource path="res://src/menu/options/Key.tscn" type="PackedScene" id=2] [ext_resource path="res://src/menu/options/KeyMenu.gd" type="Script" id=3] [ext_resource path="res://src/menu/Blink.gd" type="Script" id=4] +[ext_resource path="res://media/font/ThaleahFat.ttf" type="DynamicFontData" id=5] -[sub_resource type="DynamicFont" id=1] +[sub_resource type="DynamicFont" id=3] +size = 32 +extra_spacing_top = -8 +extra_spacing_bottom = -8 +font_data = ExtResource( 5 ) + +[sub_resource type="DynamicFont" id=2] size = 5 outline_color = Color( 0, 0, 0, 1 ) extra_spacing_top = -1 extra_spacing_bottom = -1 font_data = ExtResource( 1 ) +[sub_resource type="DynamicFont" id=4] +extra_spacing_top = -4 +extra_spacing_bottom = -4 +font_data = ExtResource( 5 ) + [node name="KeyMenu" type="CanvasLayer"] +pause_mode = 2 script = ExtResource( 3 ) parent_path = NodePath(".") list_path = NodePath("Control/VBox") @@ -22,6 +35,7 @@ is_audio_scroll = true scroll_path = NodePath("Control") row_path = NodePath("Control/VBox/Row") label_path = NodePath("Control/VBox/Label") +header_path = NodePath("Control/VBox/Header") [node name="Back" type="ColorRect" parent="."] modulate = Color( 0, 0, 0, 0.5 ) @@ -46,15 +60,25 @@ anchor_bottom = 1.0 margin_left = 50.0 margin_right = -50.0 -[node name="Guide" type="HBoxContainer" parent="Control/VBox"] +[node name="Header" type="Label" parent="Control/VBox"] margin_right = 128.0 -margin_bottom = 5.0 +margin_bottom = 14.0 +size_flags_horizontal = 9 +custom_fonts/font = SubResource( 3 ) +text = "keyboard" +align = 1 +valign = 1 + +[node name="Guide" type="HBoxContainer" parent="Control/VBox"] +margin_top = 18.0 +margin_right = 128.0 +margin_bottom = 23.0 [node name="Label" type="Label" parent="Control/VBox/Guide"] margin_right = 36.0 margin_bottom = 5.0 size_flags_horizontal = 9 -custom_fonts/font = SubResource( 1 ) +custom_fonts/font = SubResource( 2 ) text = "action" [node name="Spacer" type="Control" parent="Control/VBox/Guide"] @@ -67,29 +91,29 @@ size_flags_horizontal = 3 margin_left = 104.0 margin_right = 128.0 margin_bottom = 5.0 -custom_fonts/font = SubResource( 1 ) +custom_fonts/font = SubResource( 2 ) text = "keys" [node name="Label" type="Label" parent="Control/VBox"] -margin_top = 9.0 +margin_top = 27.0 margin_right = 128.0 -margin_bottom = 14.0 +margin_bottom = 34.0 size_flags_horizontal = 9 -custom_fonts/font = SubResource( 1 ) +custom_fonts/font = SubResource( 4 ) text = "game" align = 1 [node name="Row" type="HBoxContainer" parent="Control/VBox"] -margin_top = 18.0 +margin_top = 38.0 margin_right = 128.0 -margin_bottom = 34.0 +margin_bottom = 54.0 custom_constants/separation = 4 [node name="Label" type="Label" parent="Control/VBox/Row"] margin_top = 5.0 margin_right = 24.0 margin_bottom = 10.0 -custom_fonts/font = SubResource( 1 ) +custom_fonts/font = SubResource( 2 ) text = "jump" [node name="Keys" type="HFlowContainer" parent="Control/VBox/Row"] @@ -149,5 +173,5 @@ margin_left = 75.0 margin_top = 61.0 margin_right = 153.0 margin_bottom = 66.0 -custom_fonts/font = SubResource( 1 ) +custom_fonts/font = SubResource( 2 ) text = "press any key" diff --git a/src/menu/options/OpenKeyMenu.gd b/src/menu/options/OpenKeyMenu.gd index b8ceb6d..75c266d 100644 --- a/src/menu/options/OpenKeyMenu.gd +++ b/src/menu/options/OpenKeyMenu.gd @@ -1,7 +1,8 @@ extends CanvasItem +export var is_gamepad := false + func act(): - OptionsMenu.is_open = false - OptionsMenu.visible = false - KeyMenu.open(true) + KeyMenu.is_gamepad = is_gamepad + OptionsMenu.open_sub(KeyMenu) Audio.play("menu_pause", 0.9, 1.1) diff --git a/src/menu/options/OptionsMenu.tscn b/src/menu/options/OptionsMenu.tscn index 2bdf4a0..dcc89d5 100644 --- a/src/menu/options/OptionsMenu.tscn +++ b/src/menu/options/OptionsMenu.tscn @@ -1,19 +1,28 @@ -[gd_scene load_steps=12 format=2] +[gd_scene load_steps=13 format=2] [ext_resource path="res://src/menu/Menu.gd" type="Script" id=1] [ext_resource path="res://src/menu/options/Volume.tscn" type="PackedScene" id=2] [ext_resource path="res://src/menu/options/OpenKeyMenu.gd" type="Script" id=3] [ext_resource path="res://src/menu/Blink.gd" type="Script" id=4] [ext_resource path="res://media/audio/sfx/btn0.wav" type="AudioStream" id=5] -[ext_resource path="res://media/font/m6x11.ttf" type="DynamicFontData" id=8] -[ext_resource path="res://media/font/m3x6.tres" type="DynamicFont" id=9] +[ext_resource path="res://media/font/QuinqueFive.ttf" type="DynamicFontData" id=6] +[ext_resource path="res://media/font/ThaleahFat.ttf" type="DynamicFontData" id=7] [ext_resource path="res://src/menu/options/Fullscreen.gd" type="Script" id=20] [ext_resource path="res://src/menu/options/WindowSize.gd" type="Script" id=21] [ext_resource path="res://src/menu/options/Touch.gd" type="Script" id=22] -[sub_resource type="DynamicFont" id=1] +[sub_resource type="DynamicFont" id=4] +size = 32 +extra_spacing_top = -11 +extra_spacing_bottom = -12 +font_data = ExtResource( 7 ) + +[sub_resource type="DynamicFont" id=2] +size = 5 +outline_color = Color( 0, 0, 0, 1 ) +extra_spacing_top = -1 extra_spacing_bottom = -1 -font_data = ExtResource( 8 ) +font_data = ExtResource( 6 ) [node name="OptionsMenu" type="CanvasLayer"] pause_mode = 2 @@ -54,29 +63,33 @@ margin_right = 228.0 margin_bottom = 20.0 custom_colors/font_color_shadow = Color( 0, 0, 0, 1 ) custom_constants/shadow_as_outline = 1 -custom_fonts/font = SubResource( 1 ) +custom_fonts/font = SubResource( 4 ) text = "OPTIONS" align = 1 [node name="MenuItems" type="VBoxContainer" parent="Center/Control"] margin_left = 58.0 -margin_top = 40.0 +margin_top = 18.0 margin_right = 174.0 -margin_bottom = 108.0 +margin_bottom = 128.0 +alignment = 1 [node name="Keyboard" type="HBoxContainer" parent="Center/Control/MenuItems"] +margin_top = 15.0 margin_right = 116.0 -margin_bottom = 8.0 +margin_bottom = 23.0 +rect_min_size = Vector2( 0, 8 ) script = ExtResource( 3 ) [node name="Label" type="Label" parent="Center/Control/MenuItems/Keyboard"] -margin_right = 57.0 -margin_bottom = 8.0 -custom_fonts/font = ExtResource( 9 ) +margin_top = 1.0 +margin_right = 84.0 +margin_bottom = 6.0 +custom_fonts/font = SubResource( 2 ) text = "Keyboard Setup" [node name="Spacer" type="Control" parent="Center/Control/MenuItems/Keyboard"] -margin_left = 61.0 +margin_left = 88.0 margin_right = 104.0 margin_bottom = 8.0 size_flags_horizontal = 3 @@ -87,23 +100,50 @@ margin_right = 116.0 margin_bottom = 8.0 rect_min_size = Vector2( 8, 0 ) -[node name="Sounds" parent="Center/Control/MenuItems" instance=ExtResource( 2 )] -margin_top = 12.0 +[node name="Gamepad" type="HBoxContainer" parent="Center/Control/MenuItems"] +margin_top = 27.0 margin_right = 116.0 -margin_bottom = 20.0 +margin_bottom = 35.0 +rect_min_size = Vector2( 0, 8 ) +script = ExtResource( 3 ) +is_gamepad = true + +[node name="Label" type="Label" parent="Center/Control/MenuItems/Gamepad"] +margin_top = 1.0 +margin_right = 78.0 +margin_bottom = 6.0 +custom_fonts/font = SubResource( 2 ) +text = "gamepad Setup" + +[node name="Spacer" type="Control" parent="Center/Control/MenuItems/Gamepad"] +margin_left = 82.0 +margin_right = 104.0 +margin_bottom = 8.0 +size_flags_horizontal = 3 + +[node name="Spacer2" type="Control" parent="Center/Control/MenuItems/Gamepad"] +margin_left = 108.0 +margin_right = 116.0 +margin_bottom = 8.0 +rect_min_size = Vector2( 8, 0 ) + +[node name="Sounds" parent="Center/Control/MenuItems" instance=ExtResource( 2 )] +margin_top = 39.0 +margin_right = 116.0 +margin_bottom = 47.0 [node name="Music" parent="Center/Control/MenuItems" instance=ExtResource( 2 )] -margin_top = 24.0 +margin_top = 51.0 margin_right = 116.0 -margin_bottom = 32.0 +margin_bottom = 59.0 bus = 2 [node name="Label" parent="Center/Control/MenuItems/Music" index="0"] -margin_right = 20.0 +margin_right = 30.0 text = "Music" [node name="Spacer" parent="Center/Control/MenuItems/Music" index="1"] -margin_left = 22.0 +margin_left = 32.0 margin_right = 65.0 [node name="Arrow" parent="Center/Control/MenuItems/Music" index="2"] @@ -123,22 +163,23 @@ stream = ExtResource( 5 ) bus = "Music" [node name="Fullscreen" type="HBoxContainer" parent="Center/Control/MenuItems"] -margin_top = 36.0 +margin_top = 63.0 margin_right = 116.0 -margin_bottom = 44.0 +margin_bottom = 71.0 script = ExtResource( 20 ) [node name="Label" type="Label" parent="Center/Control/MenuItems/Fullscreen"] -margin_right = 38.0 -margin_bottom = 8.0 -custom_fonts/font = ExtResource( 9 ) +margin_top = 1.0 +margin_right = 60.0 +margin_bottom = 6.0 +custom_fonts/font = SubResource( 2 ) text = "Fullscreen" __meta__ = { "_edit_use_anchors_": false } [node name="Spacer" type="Control" parent="Center/Control/MenuItems/Fullscreen"] -margin_left = 42.0 +margin_left = 64.0 margin_right = 92.0 margin_bottom = 8.0 size_flags_horizontal = 3 @@ -172,23 +213,26 @@ margin_bottom = 8.0 rect_min_size = Vector2( 8, 0 ) [node name="WindowSize" type="HBoxContainer" parent="Center/Control/MenuItems"] -margin_top = 48.0 +margin_top = 75.0 margin_right = 116.0 -margin_bottom = 56.0 +margin_bottom = 83.0 +rect_min_size = Vector2( 0, 8 ) script = ExtResource( 21 ) [node name="Label" type="Label" parent="Center/Control/MenuItems/WindowSize"] -margin_right = 45.0 -margin_bottom = 8.0 -custom_fonts/font = ExtResource( 9 ) -text = "Window Size" +margin_top = 1.0 +margin_right = 36.0 +margin_bottom = 6.0 +custom_fonts/font = SubResource( 2 ) +text = "Window" [node name="Scale" type="Label" parent="Center/Control/MenuItems/WindowSize"] -margin_left = 49.0 -margin_right = 74.0 -margin_bottom = 8.0 +margin_left = 40.0 +margin_top = 1.0 +margin_right = 58.0 +margin_bottom = 6.0 size_flags_horizontal = 3 -custom_fonts/font = ExtResource( 9 ) +custom_fonts/font = SubResource( 2 ) text = "1x" align = 1 __meta__ = { @@ -196,27 +240,29 @@ __meta__ = { } [node name="Resolution" type="Label" parent="Center/Control/MenuItems/WindowSize"] -margin_left = 78.0 +margin_left = 62.0 +margin_top = 1.0 margin_right = 116.0 -margin_bottom = 8.0 -custom_fonts/font = ExtResource( 9 ) +margin_bottom = 6.0 +custom_fonts/font = SubResource( 2 ) text = "228 x 128" align = 1 [node name="TouchControls" type="HBoxContainer" parent="Center/Control/MenuItems"] -margin_top = 60.0 +margin_top = 87.0 margin_right = 116.0 -margin_bottom = 68.0 +margin_bottom = 95.0 script = ExtResource( 22 ) [node name="Label" type="Label" parent="Center/Control/MenuItems/TouchControls"] -margin_right = 56.0 -margin_bottom = 8.0 -custom_fonts/font = ExtResource( 9 ) +margin_top = 1.0 +margin_right = 84.0 +margin_bottom = 6.0 +custom_fonts/font = SubResource( 2 ) text = "Touch Controls" [node name="Spacer" type="Control" parent="Center/Control/MenuItems/TouchControls"] -margin_left = 60.0 +margin_left = 88.0 margin_right = 92.0 margin_bottom = 8.0 size_flags_horizontal = 3 diff --git a/src/menu/options/Volume.gd b/src/menu/options/Volume.gd index c912200..b46a400 100644 --- a/src/menu/options/Volume.gd +++ b/src/menu/options/Volume.gd @@ -12,6 +12,7 @@ export var col_off := Color("ff004d") func _ready(): set_color() + deselect() audio.bus = AudioServer.get_bus_name(bus) func select(): diff --git a/src/menu/options/Volume.tscn b/src/menu/options/Volume.tscn index d13ad57..d4b3199 100644 --- a/src/menu/options/Volume.tscn +++ b/src/menu/options/Volume.tscn @@ -1,9 +1,16 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=6 format=2] [ext_resource path="res://media/image/tinyArrow.png" type="Texture" id=1] [ext_resource path="res://media/audio/sfx/sfx14.wav" type="AudioStream" id=2] [ext_resource path="res://src/menu/options/Volume.gd" type="Script" id=3] -[ext_resource path="res://media/font/m3x6.tres" type="DynamicFont" id=4] +[ext_resource path="res://media/font/QuinqueFive.ttf" type="DynamicFontData" id=4] + +[sub_resource type="DynamicFont" id=2] +size = 5 +outline_color = Color( 0, 0, 0, 1 ) +extra_spacing_top = -1 +extra_spacing_bottom = -1 +font_data = ExtResource( 4 ) [node name="Volume" type="HBoxContainer"] margin_right = 112.0 @@ -12,13 +19,14 @@ custom_constants/separation = 2 script = ExtResource( 3 ) [node name="Label" type="Label" parent="."] -margin_right = 24.0 -margin_bottom = 8.0 -custom_fonts/font = ExtResource( 4 ) +margin_top = 1.0 +margin_right = 36.0 +margin_bottom = 6.0 +custom_fonts/font = SubResource( 2 ) text = "Sounds" [node name="Spacer" type="Control" parent="."] -margin_left = 26.0 +margin_left = 38.0 margin_right = 61.0 margin_bottom = 8.0 size_flags_horizontal = 11