Преглед на файлове

Fix condition always true in navigation demo

Nathan Lovato преди 7 години
родител
ревизия
b355e3937a
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      2d/navigation/navigation.gd

+ 1 - 1
2d/navigation/navigation.gd

@@ -32,7 +32,7 @@ func move_along_path(distance):
 	for index in range(path.size()):
 		var distance_between_points = last_point.distance_to(path[0])
 		# the position to move to falls between two points
-		if distance <= distance_between_points:
+		if distance <= distance_between_points and distance >= 0.0:
 			$Character.position = last_point.linear_interpolate(path[0], distance / distance_between_points)
 			break
 		# the character reached the end of the path