|
@@ -8,9 +8,6 @@ const DEG_LEFT = 270
|
|
|
|
|
|
var grid
|
|
|
|
|
|
-var is_moving = false
|
|
|
-var tween
|
|
|
-var target_pos = Vector2()
|
|
|
var blocks = []
|
|
|
var is_blocked:bool = false
|
|
|
export (NodePath) var rayU
|
|
@@ -22,8 +19,6 @@ var raycast
|
|
|
func _ready():
|
|
|
grid = get_parent()
|
|
|
|
|
|
- tween = $Tween
|
|
|
- tween.connect_into(self)
|
|
|
turn(Vector2(0,1))
|
|
|
pass
|
|
|
|
|
@@ -39,18 +34,12 @@ func _physics_process(delta):
|
|
|
elif Input.is_action_pressed("ui_right"):
|
|
|
direction.x += 1
|
|
|
|
|
|
- if !is_moving and direction != Vector2():
|
|
|
+ if direction != Vector2():
|
|
|
|
|
|
turn(direction)
|
|
|
|
|
|
if !raycast.is_colliding():
|
|
|
- target_pos = get_position() + direction * grid.get_cell_size()
|
|
|
- tween.move_char(self, target_pos)
|
|
|
- is_moving = true
|
|
|
- pass
|
|
|
-
|
|
|
-func _on_tween_completed(o, k):
|
|
|
- is_moving = false
|
|
|
+ position = get_position() + direction * grid.get_cell_size()
|
|
|
pass
|
|
|
|
|
|
func _on_area_entered(a):
|
|
@@ -74,4 +63,4 @@ func turn(dir:Vector2):
|
|
|
raycast=get_node(rayR)
|
|
|
else:
|
|
|
raycast=get_node(rayD)
|
|
|
- pass
|
|
|
+ pass
|