fix: better activatorArea
This commit is contained in:
parent
72b2568168
commit
def896809e
@ -229,7 +229,7 @@ duck={
|
|||||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":83,"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":0,"physical_scancode":83,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
click={
|
ui_click={
|
||||||
"deadzone": 0.5,
|
"deadzone": 0.5,
|
||||||
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
|
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":1,"pressed":false,"doubleclick":false,"script":null)
|
||||||
]
|
]
|
||||||
|
|||||||
@ -33,5 +33,6 @@ func _on_ActivatorArea_area_exited(area:Area2D) -> void:
|
|||||||
unactivatable_timer.start()
|
unactivatable_timer.start()
|
||||||
|
|
||||||
func _on_Timer_timeout():
|
func _on_Timer_timeout():
|
||||||
$Label.visible = false
|
if($ActivatorArea.get_overlapping_bodies().size() == 0):
|
||||||
activatable = false
|
$Label.visible = false
|
||||||
|
activatable = false
|
||||||
|
|||||||
@ -113,10 +113,7 @@ visible = true
|
|||||||
visible = true
|
visible = true
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
||||||
frame = 0
|
frame = 1
|
||||||
|
|
||||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
|
||||||
frame = 3
|
|
||||||
|
|
||||||
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|||||||
@ -35,8 +35,11 @@ wait_time = 20.0
|
|||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
drag_margin_bottom = 0.3
|
drag_margin_bottom = 0.3
|
||||||
|
|
||||||
|
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
||||||
|
frame = 4
|
||||||
|
|
||||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
||||||
frame = 12
|
frame = 3
|
||||||
|
|
||||||
[node name="Blobby" parent="." instance=ExtResource( 7 )]
|
[node name="Blobby" parent="." instance=ExtResource( 7 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|||||||
@ -3,6 +3,9 @@ extends Button
|
|||||||
export(String, FILE) var next_scene_path: = ""
|
export(String, FILE) var next_scene_path: = ""
|
||||||
onready var selected_level_base_path: String = "res://src/Levels/"
|
onready var selected_level_base_path: String = "res://src/Levels/"
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
self.grab_focus()
|
||||||
|
|
||||||
func _on_button_up() -> void:
|
func _on_button_up() -> void:
|
||||||
get_tree().change_scene(next_scene_path)
|
get_tree().change_scene(next_scene_path)
|
||||||
get_tree().get_current_scene().queue_free()
|
get_tree().get_current_scene().queue_free()
|
||||||
|
|||||||
@ -9,5 +9,6 @@ func clear():
|
|||||||
func add_input_line(action_name, event):
|
func add_input_line(action_name, event):
|
||||||
var line = InputLine.instance()
|
var line = InputLine.instance()
|
||||||
add_child(line)
|
add_child(line)
|
||||||
|
line.focus_mode = Control.FOCUS_ALL
|
||||||
line.initialize(action_name, event)
|
line.initialize(action_name, event)
|
||||||
return line
|
return line
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
extends ScrollContainer
|
||||||
|
|
||||||
|
|
||||||
|
func _on_focus_entered():
|
||||||
|
#get_child(0).get_child(0).grab_focus()
|
||||||
|
pass
|
||||||
@ -7,12 +7,13 @@ func _ready():
|
|||||||
$InputMapper.connect('profile_changed', self, 'rebuild')
|
$InputMapper.connect('profile_changed', self, 'rebuild')
|
||||||
$InputMapper.initialize_profiles()
|
$InputMapper.initialize_profiles()
|
||||||
$ProfilesMenu.initialize($InputMapper)
|
$ProfilesMenu.initialize($InputMapper)
|
||||||
|
$ProfilesMenu.grab_focus()
|
||||||
$InputMapper.change_profile($ProfilesMenu.selected)
|
$InputMapper.change_profile($ProfilesMenu.selected)
|
||||||
|
|
||||||
func rebuild(input_profile):
|
func rebuild(input_profile):
|
||||||
_action_list.clear()
|
_action_list.clear()
|
||||||
for input_action in input_profile.keys():
|
for input_action in input_profile.keys():
|
||||||
if(input_action.ends_with("_old")):
|
if(input_action.ends_with("_old") || input_action.begins_with(("ui_"))):
|
||||||
continue
|
continue
|
||||||
var line = _action_list.add_input_line(input_action, input_profile[input_action])
|
var line = _action_list.add_input_line(input_action, input_profile[input_action])
|
||||||
line.connect('change_button_pressed', self, '_on_InputLine_change_button_pressed', [input_action, line])
|
line.connect('change_button_pressed', self, '_on_InputLine_change_button_pressed', [input_action, line])
|
||||||
@ -28,4 +29,3 @@ func _on_InputLine_change_button_pressed(action_name, line):
|
|||||||
$InputMapper.change_action_key(action_name, old_event, event)
|
$InputMapper.change_action_key(action_name, old_event, event)
|
||||||
line.update_key(event)
|
line.update_key(event)
|
||||||
set_process_input(true)
|
set_process_input(true)
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=23 format=2]
|
[gd_scene load_steps=24 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/ui/Screenshot 2023-05-23 160521.png" type="Texture" id=1]
|
[ext_resource path="res://assets/ui/Screenshot 2023-05-23 160521.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/ProfilesMenu.gd" type="Script" id=2]
|
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/ProfilesMenu.gd" type="Script" id=2]
|
||||||
@ -15,6 +15,7 @@
|
|||||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/KeySelectMenu.gd" type="Script" id=13]
|
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/KeySelectMenu.gd" type="Script" id=13]
|
||||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/SaveButton.gd" type="Script" id=14]
|
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/SaveButton.gd" type="Script" id=14]
|
||||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/Reset.gd" type="Script" id=15]
|
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/Reset.gd" type="Script" id=15]
|
||||||
|
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/ControlScrollContainerFocus.gd" type="Script" id=16]
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=1]
|
[sub_resource type="DynamicFont" id=1]
|
||||||
size = 42
|
size = 42
|
||||||
@ -78,6 +79,8 @@ margin_right = 14.5
|
|||||||
margin_bottom = 19.0
|
margin_bottom = 19.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
focus_neighbour_top = NodePath("../Back")
|
||||||
|
focus_neighbour_bottom = NodePath("../KeymapViewer/ScrollContainer")
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="Titel" type="Label" parent="."]
|
[node name="Titel" type="Label" parent="."]
|
||||||
@ -162,11 +165,20 @@ valign = 1
|
|||||||
margin_top = 25.0
|
margin_top = 25.0
|
||||||
margin_right = 552.0
|
margin_right = 552.0
|
||||||
margin_bottom = 202.0
|
margin_bottom = 202.0
|
||||||
|
focus_neighbour_top = NodePath("../../ProfilesMenu")
|
||||||
|
focus_neighbour_bottom = NodePath("../../Save")
|
||||||
|
focus_previous = NodePath("../../Back")
|
||||||
|
focus_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
follow_focus = true
|
||||||
|
script = ExtResource( 16 )
|
||||||
|
|
||||||
[node name="ActionKeyList" type="VBoxContainer" parent="KeymapViewer/ScrollContainer"]
|
[node name="ActionKeyList" type="VBoxContainer" parent="KeymapViewer/ScrollContainer"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
margin_right = 552.0
|
||||||
|
margin_bottom = 177.0
|
||||||
|
focus_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
@ -181,6 +193,10 @@ margin_right = 75.0
|
|||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
rect_min_size = Vector2( 40, 20 )
|
rect_min_size = Vector2( 40, 20 )
|
||||||
|
focus_neighbour_left = NodePath("../Save")
|
||||||
|
focus_neighbour_top = NodePath("../KeymapViewer/ScrollContainer")
|
||||||
|
focus_neighbour_right = NodePath("../Reset")
|
||||||
|
focus_neighbour_bottom = NodePath("../ProfilesMenu")
|
||||||
input_pass_on_modal_close_click = false
|
input_pass_on_modal_close_click = false
|
||||||
size_flags_horizontal = 0
|
size_flags_horizontal = 0
|
||||||
size_flags_vertical = 0
|
size_flags_vertical = 0
|
||||||
@ -199,6 +215,10 @@ margin_right = 37.5
|
|||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
rect_min_size = Vector2( 40, 20 )
|
rect_min_size = Vector2( 40, 20 )
|
||||||
|
focus_neighbour_left = NodePath("../Back")
|
||||||
|
focus_neighbour_top = NodePath("../KeymapViewer/ScrollContainer")
|
||||||
|
focus_neighbour_right = NodePath("../Save")
|
||||||
|
focus_neighbour_bottom = NodePath("../ProfilesMenu")
|
||||||
input_pass_on_modal_close_click = false
|
input_pass_on_modal_close_click = false
|
||||||
size_flags_horizontal = 0
|
size_flags_horizontal = 0
|
||||||
size_flags_vertical = 0
|
size_flags_vertical = 0
|
||||||
@ -215,6 +235,10 @@ margin_top = -25.0
|
|||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
rect_min_size = Vector2( 40, 20 )
|
rect_min_size = Vector2( 40, 20 )
|
||||||
|
focus_neighbour_left = NodePath("../Reset")
|
||||||
|
focus_neighbour_top = NodePath("../KeymapViewer/ScrollContainer")
|
||||||
|
focus_neighbour_right = NodePath("../Back")
|
||||||
|
focus_neighbour_bottom = NodePath("../ProfilesMenu")
|
||||||
input_pass_on_modal_close_click = false
|
input_pass_on_modal_close_click = false
|
||||||
size_flags_horizontal = 0
|
size_flags_horizontal = 0
|
||||||
size_flags_vertical = 0
|
size_flags_vertical = 0
|
||||||
@ -277,6 +301,7 @@ Smile -> Save changes and leave"
|
|||||||
align = 1
|
align = 1
|
||||||
valign = 1
|
valign = 1
|
||||||
|
|
||||||
|
[connection signal="focus_entered" from="KeymapViewer/ScrollContainer" to="KeymapViewer/ScrollContainer" method="_on_focus_entered"]
|
||||||
[connection signal="button_up" from="Back" to="Back" method="_on_button_up"]
|
[connection signal="button_up" from="Back" to="Back" method="_on_button_up"]
|
||||||
[connection signal="button_up" from="Reset" to="Reset" method="_on_button_up"]
|
[connection signal="button_up" from="Reset" to="Reset" method="_on_button_up"]
|
||||||
[connection signal="button_up" from="Save" to="Save" method="_on_button_up"]
|
[connection signal="button_up" from="Save" to="Save" method="_on_button_up"]
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
extends OptionButton
|
extends OptionButton
|
||||||
|
|
||||||
|
|
||||||
func initialize(input_mapper):
|
func initialize(input_mapper):
|
||||||
for profile_index in input_mapper.profiles:
|
for profile_index in input_mapper.profiles:
|
||||||
var profile_name = input_mapper.profiles[profile_index].capitalize()
|
var profile_name = input_mapper.profiles[profile_index].capitalize()
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
extends Button
|
extends Button
|
||||||
|
|
||||||
onready var signalManager := get_tree().root.get_child(3).get_node("%SignalManager")
|
|
||||||
onready var mapper := $"%InputMapper"
|
onready var mapper := $"%InputMapper"
|
||||||
|
|
||||||
func _on_button_up() -> void:
|
func _on_button_up() -> void:
|
||||||
|
|||||||
@ -24,9 +24,17 @@ func _fill_level_list():
|
|||||||
_spawn_level_options(levels)
|
_spawn_level_options(levels)
|
||||||
|
|
||||||
func _spawn_level_options(levels: Array):
|
func _spawn_level_options(levels: Array):
|
||||||
|
var first = true
|
||||||
for level in levels:
|
for level in levels:
|
||||||
var check_box = CheckBox.new()
|
var check_box = CheckBox.new()
|
||||||
|
if first:
|
||||||
|
$"%PlayButton".focus_neighbour_right = check_box.get_path()
|
||||||
|
$"%Controlls".focus_neighbour_right = check_box.get_path()
|
||||||
|
$"%QuitButton".focus_neighbour_right = check_box.get_path()
|
||||||
|
first = false
|
||||||
|
check_box.focus_mode = Control.FOCUS_ALL
|
||||||
|
check_box.focus_neighbour_left = $"%PlayButton".get_path()
|
||||||
check_box.text = level.trim_suffix(".tscn")
|
check_box.text = level.trim_suffix(".tscn")
|
||||||
check_box.set_button_group(BUTTON_GROUP);
|
check_box.set_button_group(BUTTON_GROUP)
|
||||||
vbox.add_child(check_box)
|
vbox.add_child(check_box)
|
||||||
return
|
return
|
||||||
|
|||||||
@ -66,41 +66,55 @@ margin_bottom = 88.0
|
|||||||
[node name="Buttons" type="VBoxContainer" parent="MenuContainer"]
|
[node name="Buttons" type="VBoxContainer" parent="MenuContainer"]
|
||||||
margin_right = 296.0
|
margin_right = 296.0
|
||||||
margin_bottom = 100.0
|
margin_bottom = 100.0
|
||||||
|
focus_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
[node name="PlayButton" parent="MenuContainer/Buttons" instance=ExtResource( 3 )]
|
[node name="PlayButton" parent="MenuContainer/Buttons" instance=ExtResource( 3 )]
|
||||||
|
unique_name_in_owner = true
|
||||||
margin_right = 296.0
|
margin_right = 296.0
|
||||||
margin_bottom = 30.0
|
margin_bottom = 30.0
|
||||||
|
focus_neighbour_top = NodePath("../QuitButton")
|
||||||
|
focus_neighbour_bottom = NodePath("../Controlls")
|
||||||
|
|
||||||
[node name="Controlls" parent="MenuContainer/Buttons" instance=ExtResource( 3 )]
|
[node name="Controlls" parent="MenuContainer/Buttons" instance=ExtResource( 3 )]
|
||||||
|
unique_name_in_owner = true
|
||||||
margin_top = 34.0
|
margin_top = 34.0
|
||||||
margin_right = 296.0
|
margin_right = 296.0
|
||||||
margin_bottom = 65.0
|
margin_bottom = 65.0
|
||||||
|
focus_neighbour_top = NodePath("../PlayButton")
|
||||||
|
focus_neighbour_bottom = NodePath("../QuitButton")
|
||||||
text = "Controls"
|
text = "Controls"
|
||||||
script = ExtResource( 10 )
|
script = ExtResource( 10 )
|
||||||
next_screen_path = "res://src/UserInterface/Screens/ControlsMenu/ControlsMenu.tscn"
|
next_screen_path = "res://src/UserInterface/Screens/ControlsMenu/ControlsMenu.tscn"
|
||||||
|
|
||||||
[node name="QuitButton" parent="MenuContainer/Buttons" instance=ExtResource( 1 )]
|
[node name="QuitButton" parent="MenuContainer/Buttons" instance=ExtResource( 1 )]
|
||||||
|
unique_name_in_owner = true
|
||||||
anchor_left = 0.0
|
anchor_left = 0.0
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
margin_left = 0.0
|
margin_left = 0.0
|
||||||
margin_top = 69.0
|
margin_top = 69.0
|
||||||
margin_right = 296.0
|
margin_right = 296.0
|
||||||
margin_bottom = 100.0
|
margin_bottom = 100.0
|
||||||
|
focus_neighbour_top = NodePath("../Controlls")
|
||||||
|
focus_neighbour_bottom = NodePath("../PlayButton")
|
||||||
|
|
||||||
[node name="LevelList" type="ScrollContainer" parent="MenuContainer"]
|
[node name="LevelList" type="ScrollContainer" parent="MenuContainer"]
|
||||||
margin_left = 300.0
|
margin_left = 300.0
|
||||||
margin_right = 300.0
|
margin_right = 300.0
|
||||||
margin_bottom = 100.0
|
margin_bottom = 100.0
|
||||||
|
focus_mode = 2
|
||||||
|
follow_focus = true
|
||||||
scroll_horizontal_enabled = false
|
scroll_horizontal_enabled = false
|
||||||
script = ExtResource( 6 )
|
script = ExtResource( 6 )
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="MenuContainer/LevelList"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MenuContainer/LevelList"]
|
||||||
|
focus_mode = 2
|
||||||
|
|
||||||
[node name="InvisibleCunt" type="CheckBox" parent="MenuContainer/LevelList/VBoxContainer"]
|
[node name="InvisibleCunt" type="CheckBox" parent="MenuContainer/LevelList/VBoxContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
margin_right = 24.0
|
margin_right = 24.0
|
||||||
margin_bottom = 24.0
|
margin_bottom = 24.0
|
||||||
|
focus_neighbour_left = NodePath("../../../Buttons/PlayButton")
|
||||||
group = ExtResource( 7 )
|
group = ExtResource( 7 )
|
||||||
|
|
||||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user