Browse Source

Merge pull request #3105 from Beuc/patch-1

Keep velocity in _process as in the previous step
Chris Bradfield 5 years ago
parent
commit
c664daf328
1 changed files with 1 additions and 1 deletions
  1. 1 1
      getting_started/step_by_step/exporting.rst

+ 1 - 1
getting_started/step_by_step/exporting.rst

@@ -60,7 +60,6 @@ changed:
     signal hit
     signal hit
 
 
     export var speed = 400
     export var speed = 400
-    var velocity = Vector2()
     var screen_size
     var screen_size
     # Add this variable to hold the clicked position.
     # Add this variable to hold the clicked position.
     var target = Vector2()
     var target = Vector2()
@@ -82,6 +81,7 @@ changed:
             target = event.position
             target = event.position
 
 
     func _process(delta):
     func _process(delta):
+        var velocity = Vector2()
         # Move towards the target and stop when close.
         # Move towards the target and stop when close.
         if position.distance_to(target) > 10:
         if position.distance_to(target) > 10:
             velocity = (target - position).normalized() * speed
             velocity = (target - position).normalized() * speed