|
|
|
@ -20,12 +20,16 @@ func _physics_process(delta): |
|
|
|
|
|
|
|
|
|
if Input.is_action_pressed("ui_up"): |
|
|
|
|
direction += Vector3(0, 0, -1) |
|
|
|
|
set_rotation_degrees(Vector3(0, 180, 0)) |
|
|
|
|
if Input.is_action_pressed("ui_down"): |
|
|
|
|
direction += Vector3(0, 0, 1) |
|
|
|
|
set_rotation_degrees(Vector3(0, 0, 0)) |
|
|
|
|
if Input.is_action_pressed("ui_left"): |
|
|
|
|
direction += Vector3(-1, 0, 0) |
|
|
|
|
set_rotation_degrees(Vector3(0, -90, 0)) |
|
|
|
|
if Input.is_action_pressed("ui_right"): |
|
|
|
|
direction += Vector3(1, 0, 0) |
|
|
|
|
set_rotation_degrees(Vector3(0, 90, 0)) |
|
|
|
|
|
|
|
|
|
direction.y = 0 |
|
|
|
|
direction = direction.normalized() |
|
|
|
|