feat: controller type detecting buttons in menu
This commit is contained in:
parent
432c033bcc
commit
d1c50e2629
Binary file not shown.
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
@ -156,6 +156,55 @@ ogg_vorbis={
|
|||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
|
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":0,"physical_scancode":87,"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)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
duck={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"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":0,"physical_scancode":83,"unicode":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
move_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(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
move_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(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
jump={
|
||||||
|
"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":32,"physical_scancode":0,"unicode":0,"echo":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(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":16777232,"unicode":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
boost_move={
|
||||||
|
"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":16777237,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
interact={
|
||||||
|
"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":0,"physical_scancode":69,"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)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
]
|
||||||
|
}
|
||||||
ui_accept={
|
ui_accept={
|
||||||
"deadzone": 0.5,
|
"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":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
"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":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
@ -197,55 +246,6 @@ ui_click={
|
|||||||
"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)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
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)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
boost_move={
|
|
||||||
"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":16777237,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
|
||||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":1,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
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":0,"physical_scancode":87,"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)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
duck={
|
|
||||||
"deadzone": 0.5,
|
|
||||||
"events": [ Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"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":0,"physical_scancode":83,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
interact={
|
|
||||||
"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":0,"physical_scancode":69,"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)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
jump={
|
|
||||||
"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":32,"physical_scancode":0,"unicode":0,"echo":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(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":16777232,"unicode":0,"echo":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
move_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(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
move_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(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
|||||||
@ -971,10 +971,9 @@ texture = ExtResource( 8 )
|
|||||||
|
|
||||||
[node name="AnimatedSprite" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
|
[node name="AnimatedSprite" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
|
||||||
frames = SubResource( 7 )
|
frames = SubResource( 7 )
|
||||||
frame = 6
|
|
||||||
playing = true
|
playing = true
|
||||||
|
|
||||||
[node name="AnimatedSprite2" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
|
[node name="AnimatedSprite2" type="AnimatedSprite" parent="ParallaxBackground/ParallaxLayer5"]
|
||||||
frames = SubResource( 8 )
|
frames = SubResource( 8 )
|
||||||
frame = 11
|
frame = 5
|
||||||
playing = true
|
playing = true
|
||||||
|
|||||||
@ -103,20 +103,14 @@ 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="Sprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer2" index="0"]
|
|
||||||
visible = true
|
|
||||||
|
|
||||||
[node name="Sprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer3" index="0"]
|
|
||||||
visible = true
|
|
||||||
|
|
||||||
[node name="Emitter3" parent="BlobbyCam/ParallaxBackground/ParallaxLayer4" index="1"]
|
[node name="Emitter3" parent="BlobbyCam/ParallaxBackground/ParallaxLayer4" index="1"]
|
||||||
visible = true
|
visible = true
|
||||||
|
|
||||||
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
[node name="AnimatedSprite" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="4"]
|
||||||
frame = 4
|
frame = 13
|
||||||
|
|
||||||
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
[node name="AnimatedSprite2" parent="BlobbyCam/ParallaxBackground/ParallaxLayer5" index="5"]
|
||||||
frame = 11
|
frame = 6
|
||||||
|
|
||||||
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
[node name="Blobby" parent="." instance=ExtResource( 9 )]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/InputMapper.gd" type="Script" id=4]
|
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/InputMapper.gd" type="Script" id=4]
|
||||||
[ext_resource path="res://assets/meta/ui_theme.tres" type="Theme" id=5]
|
[ext_resource path="res://assets/meta/ui_theme.tres" type="Theme" id=5]
|
||||||
[ext_resource path="res://assets/meta/montserrat_extrabold.otf" type="DynamicFontData" id=6]
|
[ext_resource path="res://assets/meta/montserrat_extrabold.otf" type="DynamicFontData" id=6]
|
||||||
[ext_resource path="res://assets/environment/background/space.png" type="Texture" id=7]
|
[ext_resource path="res://assets/environment/background/starry-space.png" type="Texture" id=7]
|
||||||
[ext_resource path="res://assets/environment/background/Spaceship-Wall.png" type="Texture" id=8]
|
[ext_resource path="res://assets/environment/background/Spaceship-Wall.png" type="Texture" id=8]
|
||||||
[ext_resource path="res://src/transparency.gdshader" type="Shader" id=9]
|
[ext_resource path="res://src/transparency.gdshader" type="Shader" id=9]
|
||||||
[ext_resource path="res://assets/sounds/EpsonStart.ogg" type="AudioStream" id=10]
|
[ext_resource path="res://assets/sounds/EpsonStart.ogg" type="AudioStream" id=10]
|
||||||
@ -57,6 +57,8 @@ script = ExtResource( 4 )
|
|||||||
[node name="background" type="TextureRect" parent="."]
|
[node name="background" type="TextureRect" parent="."]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
|
margin_top = 46.0
|
||||||
|
margin_bottom = 46.0
|
||||||
texture = ExtResource( 7 )
|
texture = ExtResource( 7 )
|
||||||
expand = true
|
expand = true
|
||||||
stretch_mode = 1
|
stretch_mode = 1
|
||||||
|
|||||||
@ -2,12 +2,29 @@ extends HBoxContainer
|
|||||||
|
|
||||||
signal change_button_pressed
|
signal change_button_pressed
|
||||||
|
|
||||||
|
export var button_size: Vector2 = Vector2(30,30)
|
||||||
|
export var interactable: bool = false
|
||||||
|
|
||||||
func initialize(action_name, event):
|
func initialize(action_name, event):
|
||||||
$Action.text = action_name.capitalize()
|
$Action.text = action_name.capitalize()
|
||||||
$Key.texture = ControllerIcons.parse_event(event)
|
$Key.add_child(create_controller_button(event))
|
||||||
|
|
||||||
func update_key(event):
|
func update_key(event):
|
||||||
$Key.texture = ControllerIcons.parse_event(event)
|
$Key.remove_child($Key.get_child(0))
|
||||||
|
$Key.add_child(create_controller_button(event))
|
||||||
|
|
||||||
|
func create_controller_button(event) -> ControllerButton:
|
||||||
|
var event_path = ControllerIcons._convert_event_to_path(event)
|
||||||
|
var controller_button: ControllerButton = ControllerButton.new()
|
||||||
|
controller_button.path = event_path
|
||||||
|
if(!interactable):
|
||||||
|
controller_button.focus_mode = FOCUS_NONE
|
||||||
|
controller_button.enabled_focus_mode = FOCUS_NONE
|
||||||
|
controller_button.mouse_filter = MOUSE_FILTER_IGNORE
|
||||||
|
controller_button.rect_size = button_size
|
||||||
|
controller_button.expand_icon = true
|
||||||
|
return controller_button
|
||||||
|
|
||||||
|
|
||||||
func _on_ChangeButton_pressed():
|
func _on_ChangeButton_pressed():
|
||||||
emit_signal('change_button_pressed')
|
emit_signal('change_button_pressed')
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/InputLine.gd" type="Script" id=1]
|
[ext_resource path="res://src/UserInterface/Screens/ControlsMenu/InputLine.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://addons/controller_icons/objects/TextureRect.gd" type="Script" id=2]
|
|
||||||
|
|
||||||
[node name="InputLine" type="HBoxContainer"]
|
[node name="InputLine" type="HBoxContainer"]
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
@ -21,19 +20,11 @@ size_flags_vertical = 1
|
|||||||
text = "Up"
|
text = "Up"
|
||||||
valign = 1
|
valign = 1
|
||||||
|
|
||||||
[node name="Key" type="TextureRect" parent="."]
|
[node name="Key" type="Control" parent="."]
|
||||||
margin_left = 305.0
|
margin_left = 305.0
|
||||||
margin_right = 335.0
|
margin_right = 335.0
|
||||||
margin_bottom = 30.0
|
margin_bottom = 30.0
|
||||||
grow_horizontal = 0
|
|
||||||
grow_vertical = 0
|
|
||||||
rect_min_size = Vector2( 30, 30 )
|
rect_min_size = Vector2( 30, 30 )
|
||||||
size_flags_horizontal = 0
|
|
||||||
size_flags_vertical = 0
|
|
||||||
expand = true
|
|
||||||
stretch_mode = 1
|
|
||||||
script = ExtResource( 2 )
|
|
||||||
max_width = 30
|
|
||||||
|
|
||||||
[node name="ChangeButton" type="Button" parent="."]
|
[node name="ChangeButton" type="Button" parent="."]
|
||||||
margin_left = 582.0
|
margin_left = 582.0
|
||||||
|
|||||||
@ -41,6 +41,7 @@ func erase_action_events(action_name, event):
|
|||||||
|
|
||||||
func initialize_profiles() -> void:
|
func initialize_profiles() -> void:
|
||||||
var actions: Array = InputMap.get_actions()
|
var actions: Array = InputMap.get_actions()
|
||||||
|
actions.sort()
|
||||||
for action in actions:
|
for action in actions:
|
||||||
var input_events = InputMap.get_action_list(action)
|
var input_events = InputMap.get_action_list(action)
|
||||||
for event in input_events:
|
for event in input_events:
|
||||||
|
|||||||
@ -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:
|
||||||
|
|||||||
@ -37,9 +37,11 @@ func _zoom_timer() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func update_interface() -> void:
|
func update_interface() -> void:
|
||||||
|
var wallet = GlobalState.gsr.wallet
|
||||||
var wallet = GlobalState.gsr.wallet + levelState.currency
|
if levelState != null:
|
||||||
|
wallet += levelState.currency
|
||||||
currency.text = "Orbs: %s" % wallet
|
|
||||||
kills.text = "Kills: %s" % levelState.kills
|
kills.text = "Kills: %s" % levelState.kills
|
||||||
frees.text = "Freed: %s" % levelState.frees
|
frees.text = "Freed: %s" % levelState.frees
|
||||||
|
|
||||||
|
currency.text = "Orbs: %s" % wallet
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,7 @@ tracks/0/keys = {
|
|||||||
pause_mode = 2
|
pause_mode = 2
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
mouse_filter = 2
|
mouse_filter = 1
|
||||||
theme = ExtResource( 1 )
|
theme = ExtResource( 1 )
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user