Touch Screen Joy stick Custom Output

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Aethenwulf

When you drag the joy stick around it will trigger or like press the keyboard buttons, I don’t know how to explain it properly so I hope you get the idea by this graph

/-Min-/ - /-Max-/ - /-Keyboard Keys-/
337.5° - 022.5° - D
022.5° - 067.5° - D + W
067.5° - 112.5° - W
112.5° - 157.5° - W + A
157.5° - 202.5° - A
202.5° - 247.5° - A + S
247.5° - 292.5° - S
292.5° - 337.5° - S + D

I want to know if this idea is possible, if so how?
I want to implement this on moving the Player.

:bust_in_silhouette: Reply From: timothybrentwood

Map your Left Joy Axis Left, Left Joy Axis Right, Left Joy Axis Down, and Left Joy Axis Up in your Project-> Project Settings -> Input Map then write an additive input event handler:

var direction_vector = Vector2.ZERO
if Input.is_action_pressed("left_joy_left"):
	direction_vector += Vector2.LEFT
if Input.is_action_pressed("left_joy_down"):
	direction_vector += Vector2.DOWN
if Input.is_action_pressed("left_joy_right"):
	direction_vector += Vector2.RIGHT
if Input.is_action_pressed("left_joy_up"):
	direction_vector += Vector2.UP

So if you have your joystick rotated up and left: direction_vector = Vector2.UP + Vector2.LEFT = (-1, -1) which would be equivalent to you pressing W + A in most games.