forked from ARHS-Game-Development-Club/Prototype
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetInputDirection.gd
More file actions
28 lines (21 loc) · 825 Bytes
/
GetInputDirection.gd
File metadata and controls
28 lines (21 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func get_normalized_input_direction():
var input_vector := Vector2(
Input.get_action_strength("move_right") - Input.get_action_strength("move_left"),
Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
)
return input_vector.normalized()
func get_binary_input_direction():
return Vector2(
float(Input.is_action_pressed("move_right")) - float(Input.is_action_pressed("move_left")),
float(Input.is_action_pressed("move_down")) - float(Input.is_action_pressed("move_up"))
)
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass