Experimenting with a gamepad. Use ui_accept/ui_menu in code. On my controller, start is button 7, not the one indicated by Godot.
This commit is contained in:
parent
9427f6574b
commit
dc519723a1
|
@ -22,6 +22,21 @@ window/size/resizable=false
|
|||
window/stretch/mode="2d"
|
||||
window/stretch/aspect="keep"
|
||||
|
||||
[input]
|
||||
|
||||
ui_cancel={
|
||||
"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,"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)
|
||||
]
|
||||
}
|
||||
ui_menu={
|
||||
"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,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":7,"pressure":0.0,"pressed":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
2d_physics/layer_1="paddle"
|
||||
|
|
|
@ -17,5 +17,5 @@ func init(hasWon, score):
|
|||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
if Input.is_action_just_pressed('ui_select') or Input.is_action_just_pressed('ui_cancel'):
|
||||
if Input.is_action_just_pressed('ui_accept') or Input.is_action_just_pressed('ui_menu'):
|
||||
emit_signal("next_screen", "start")
|
||||
|
|
|
@ -36,9 +36,9 @@ func init(level_index):
|
|||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
if not paused:
|
||||
if Input.is_action_just_pressed('ui_select'):
|
||||
if Input.is_action_just_pressed('ui_accept'):
|
||||
ball.detach()
|
||||
if Input.is_action_just_pressed("ui_cancel"):
|
||||
if Input.is_action_just_pressed("ui_menu"):
|
||||
emit_signal("next_screen", "pause")
|
||||
|
||||
func pause():
|
||||
|
|
|
@ -13,7 +13,7 @@ func init():
|
|||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
if Input.is_action_just_pressed('ui_select'):
|
||||
if Input.is_action_just_pressed('ui_accept'):
|
||||
emit_signal("next_screen", "game")
|
||||
elif Input.is_action_just_pressed('ui_cancel'):
|
||||
elif Input.is_action_just_pressed('ui_menu'):
|
||||
emit_signal("next_screen", "game_lost")
|
||||
|
|
|
@ -14,9 +14,9 @@ func init():
|
|||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
if Input.is_action_just_pressed('ui_select'):
|
||||
if Input.is_action_just_pressed('ui_accept'):
|
||||
emit_signal("next_screen", "game")
|
||||
elif Input.is_action_just_pressed("ui_cancel"):
|
||||
elif Input.is_action_just_pressed("ui_menu"):
|
||||
get_tree().notification(MainLoop.NOTIFICATION_WM_QUIT_REQUEST)
|
||||
|
||||
func _on_Timer_timeout():
|
||||
|
|
Loading…
Reference in New Issue