diff --git a/src/autoload/Shared.gd b/src/autoload/Shared.gd index 9fa06e6..f24ac9c 100644 --- a/src/autoload/Shared.gd +++ b/src/autoload/Shared.gd @@ -306,6 +306,7 @@ func change_scene(): speedrun_goal(csfn, map_name != "" and not "hub" in map_name) set_boundary() + TouchScreen.set_game(map_name != "") emit_signal("scene_changed") func set_boundary(): diff --git a/src/autoload/touch_screen.gd b/src/autoload/touch_screen.gd index 9680482..97721fe 100644 --- a/src/autoload/touch_screen.gd +++ b/src/autoload/touch_screen.gd @@ -7,6 +7,7 @@ onready var keys := [$Control/HBoxRight/C, $Control/HBoxRight/X] onready var buttons := [$Control/HBoxRight/C/Control/Button, $Control/HBoxRight/X/Control/Button] onready var btns := $Control/HBoxLeft/DPad/Buttons.get_children() +onready var actions := InputMap.get_actions() func _ready(): connect("visibility_changed", self, "vis") @@ -29,8 +30,12 @@ func show_keys(arg_arrows := true, arg_c := true, arg_x := true, arg_pause := fa func set_game(arg := false): var i = "" if arg else "ui_" set_actions(i + "up", i + "down", i + "left", i + "right") - buttons[0].action = "action" if arg else "ui_cancel" + buttons[0].action = "grab" if arg else "ui_cancel" buttons[1].action = "jump" if arg else "ui_accept" + + for a in actions: + Input.action_release(a) + for f in buttons: f.passby_press = arg diff --git a/src/autoload/touch_screen.tscn b/src/autoload/touch_screen.tscn index 942e426..c8e0ba6 100644 --- a/src/autoload/touch_screen.tscn +++ b/src/autoload/touch_screen.tscn @@ -6,7 +6,7 @@ [ext_resource path="res://media/font/mini-wakuwaku.otf" type="DynamicFontData" id=5] [ext_resource path="res://src/class/shape/Circle.gd" type="Script" id=8] -[sub_resource type="ConvexPolygonShape2D" id=7] +[sub_resource type="ConvexPolygonShape2D" id=11] points = PoolVector2Array( 7.07107, 7.07107, 9.2388, 3.82683, 10, 0, 9.2388, -3.82683, 7.07107, -7.07107, 353.553, -353.553, 461.94, -191.342, 500, 0, 461.94, 191.342, 353.553, 353.553 ) [sub_resource type="ConvexPolygonShape2D" id=8] @@ -32,7 +32,7 @@ font_data = ExtResource( 5 ) radius = 75.0 [sub_resource type="CircleShape2D" id=5] -radius = 15.0 +radius = 100.0 [node name="TouchScreen" type="CanvasLayer"] pause_mode = 2 @@ -66,7 +66,7 @@ margin_right = 150.0 margin_bottom = 150.0 [node name="0" type="TouchScreenButton" parent="Control/HBoxLeft/DPad/Buttons"] -shape = SubResource( 7 ) +shape = SubResource( 11 ) shape_centered = false action = "ui_right" script = ExtResource( 3 ) diff --git a/src/menu/MenuMakeover.gd b/src/menu/MenuMakeover.gd index 4194cb5..2541ef4 100644 --- a/src/menu/MenuMakeover.gd +++ b/src/menu/MenuMakeover.gd @@ -28,12 +28,14 @@ func open(): player.is_input = false palette = Shared.player.palette match_player() + TouchScreen.set_game(false) func close(): Cam.turn_offset = Vector2.ZERO Cam.start_zoom(0) player.is_input = true + TouchScreen.set_game(true) func accept(): match items[cursor].name.to_lower(): diff --git a/src/menu/MenuPause.gd b/src/menu/MenuPause.gd index b5c9743..b0120d3 100644 --- a/src/menu/MenuPause.gd +++ b/src/menu/MenuPause.gd @@ -45,6 +45,7 @@ func set_open(arg := is_open, is_audio := true): #get_tree().paused = is_open Cam.turn_offset = Vector2(400 if is_open else 0, 0) * (1 if randf() > 0.5 else -1) * Cam.zoom.x + TouchScreen.set_game(!is_open) # setup items if is_open: