|
@@ -1,40 +1,28 @@
|
|
|
extends Area2D
|
|
|
|
|
|
-var direction = Vector2()
|
|
|
-
|
|
|
-const DEG_UP = 0
|
|
|
-const DEG_RIGHT = 90
|
|
|
-const DEG_DOWN = 180
|
|
|
-const DEG_LEFT = 270
|
|
|
-
|
|
|
-const DEG_LIST = [DEG_UP, DEG_RIGHT, DEG_DOWN, DEG_LEFT]
|
|
|
+# Nodes
|
|
|
+var grid
|
|
|
+var tween
|
|
|
+var rayFront
|
|
|
+var rayLeft
|
|
|
+var rayRight
|
|
|
|
|
|
+# Enum
|
|
|
const DIR_UP = 0
|
|
|
const DIR_RIGHT = 1
|
|
|
const DIR_DOWN = 2
|
|
|
const DIR_LEFT = 3
|
|
|
|
|
|
+# Movement
|
|
|
var posix
|
|
|
var posiy
|
|
|
-
|
|
|
var dirx = 0
|
|
|
var diry = 0
|
|
|
|
|
|
-var dire = DIR_UP
|
|
|
-
|
|
|
-var grid
|
|
|
+export var dire = DIR_UP
|
|
|
|
|
|
var is_moving = false
|
|
|
-
|
|
|
-var tween
|
|
|
-
|
|
|
-var target_pos = Vector2()
|
|
|
-var blocks = []
|
|
|
-var is_blocked:bool = false
|
|
|
-
|
|
|
-var rayFront
|
|
|
-var rayLeft
|
|
|
-var rayRight
|
|
|
+var target_pos
|
|
|
|
|
|
func _ready():
|
|
|
grid = get_parent()
|
|
@@ -42,7 +30,7 @@ func _ready():
|
|
|
posix = int (position.x / 64)
|
|
|
posiy = int (position.y / 64)
|
|
|
|
|
|
- turn(DIR_UP)
|
|
|
+ turn(dire)
|
|
|
|
|
|
tween = $Tween
|
|
|
tween.connect_into(self)
|