gd: added input addon
This commit is contained in:
20
guide_examples/top_down_shooter/top_down_shooter.gd
Normal file
20
guide_examples/top_down_shooter/top_down_shooter.gd
Normal file
@ -0,0 +1,20 @@
|
||||
extends Node2D
|
||||
|
||||
@export var keyboard_and_mouse:GUIDEMappingContext
|
||||
@export var controller:GUIDEMappingContext
|
||||
|
||||
@export var switch_to_controller:GUIDEAction
|
||||
@export var switch_to_keyboard_and_mouse:GUIDEAction
|
||||
|
||||
func _ready():
|
||||
# enable controller at the start
|
||||
GUIDE.enable_mapping_context(controller)
|
||||
|
||||
# Switch the control scheme depending on the input.
|
||||
switch_to_controller.triggered \
|
||||
.connect(func(): GUIDE.enable_mapping_context(controller, true))
|
||||
switch_to_keyboard_and_mouse.triggered \
|
||||
.connect(func(): GUIDE.enable_mapping_context(keyboard_and_mouse, true))
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user