improve multiplayer controller movement
This commit is contained in:
@@ -19,9 +19,10 @@ var _move_down: float
|
||||
|
||||
|
||||
func handle_input(event: InputEvent, mode: Inputer.Mode) -> void:
|
||||
if mode == Inputer.Mode.KB_MOUSE:
|
||||
if event is not InputEventKey:
|
||||
return
|
||||
if Referencer.players_count == 1:
|
||||
return
|
||||
|
||||
if mode == Inputer.Mode.KB_MOUSE and event is InputEventKey:
|
||||
var key_event := event as InputEventKey
|
||||
if key_event.is_action_pressed("move_left"):
|
||||
_move_left = 1
|
||||
@@ -40,11 +41,16 @@ func handle_input(event: InputEvent, mode: Inputer.Mode) -> void:
|
||||
elif key_event.is_action_released("move_down"):
|
||||
_move_down = 0
|
||||
|
||||
if mode == Inputer.Mode.CONTROLLER:
|
||||
_move_left = Input.get_action_raw_strength("move_left")
|
||||
_move_right = Input.get_action_raw_strength("move_right")
|
||||
_move_up = Input.get_action_raw_strength("move_up")
|
||||
_move_down = Input.get_action_raw_strength("move_down")
|
||||
if mode == Inputer.Mode.CONTROLLER and event is InputEventJoypadMotion:
|
||||
var motion_event := event as InputEventJoypadMotion
|
||||
if motion_event.is_action("move_left"):
|
||||
_move_left = motion_event.get_action_strength("move_left")
|
||||
if motion_event.is_action("move_right"):
|
||||
_move_right = motion_event.get_action_strength("move_right")
|
||||
if motion_event.is_action("move_up"):
|
||||
_move_up = motion_event.get_action_strength("move_up")
|
||||
if motion_event.is_action("move_down"):
|
||||
_move_down = motion_event.get_action_strength("move_down")
|
||||
|
||||
|
||||
func movement(
|
||||
|
||||
Reference in New Issue
Block a user