Refactor player animation and collision based entrances
This commit is contained in:
13
Scripts/vector2_utils.gd
Normal file
13
Scripts/vector2_utils.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
extends Node
|
||||
class_name Vector2Utils
|
||||
|
||||
static func GetClosestDirectionVector(dv: Vector2) -> Vector2:
|
||||
if dv == Vector2.ZERO:
|
||||
return dv
|
||||
if dv.y < 0:
|
||||
return Vector2.UP
|
||||
if dv.y > 0:
|
||||
return Vector2.DOWN
|
||||
if dv.x < 0:
|
||||
return Vector2.LEFT
|
||||
return Vector2.RIGHT
|
||||
Reference in New Issue
Block a user