|
@@ -12,11 +12,10 @@ var target_reached = true
|
|
|
var _current_state
|
|
|
|
|
|
|
|
|
-func spawn(atPos):
|
|
|
+func spawn(pos):
|
|
|
_current_state = State.DODGING
|
|
|
- position = atPos
|
|
|
$CollisionShape2D.disabled = false
|
|
|
- $AnimatedSprite.animation = "idle"
|
|
|
+ go_to(pos)
|
|
|
|
|
|
|
|
|
func sleep():
|
|
@@ -56,10 +55,14 @@ func dodge(delta: float):
|
|
|
$AnimatedSprite.animation = "idle"
|
|
|
|
|
|
|
|
|
+func go_to(pos: Vector2):
|
|
|
+ target = pos
|
|
|
+ target_reached = false
|
|
|
+
|
|
|
+
|
|
|
func _input(event):
|
|
|
if event is InputEventMouseButton or event is InputEventMouseMotion :
|
|
|
- target = event.position
|
|
|
- target_reached = false
|
|
|
+ go_to(event.position)
|
|
|
|
|
|
|
|
|
func _on_Player_body_entered(_body):
|