its working!! WIP

This commit is contained in:
Harmony Honey Monroe 2024-09-20 21:14:58 -04:00
parent a13871aec1
commit fb747d6c2d
5 changed files with 13 additions and 4 deletions

View file

@ -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():

View file

@ -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

View file

@ -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 )

View file

@ -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():

View file

@ -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: