浏览代码

Small fix in Custom drawing for 2D

Change Vector2Array to PoolVector2Array
Max Hilbrunner 7 年之前
父节点
当前提交
6c6811b32a
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      tutorials/2d/custom_drawing_in_2d.rst

+ 2 - 2
tutorials/2d/custom_drawing_in_2d.rst

@@ -112,7 +112,7 @@ Basically, drawing a shape on screen requires it to be decomposed into a certain
 
     func draw_circle_arc(center, radius, angle_from, angle_to, color):
         var nb_points = 32
-        var points_arc = Vector2Array()
+        var points_arc = PoolVector2Array()
     
         for i in range(nb_points+1):
             var angle_point = angle_from + i * (angle_to-angle_from) / nb_points - 90
@@ -122,7 +122,7 @@ Basically, drawing a shape on screen requires it to be decomposed into a certain
         for index_point in range(nb_points):
             draw_line(points_arc[index_point], points_arc[index_point + 1], color)
 
-Remember the number of points our shape has to be decomposed into? We fixed this number in the nb_points variable to a value of 32. Then, we initialize an empty Vector2Array, which is simply an array of Vector2.
+Remember the number of points our shape has to be decomposed into? We fixed this number in the nb_points variable to a value of 32. Then, we initialize an empty PoolVector2Array, which is simply an array of Vector2.
 
 The next step consists of computing the actual positions of these 32 points that compose an arc. This is done in the first for-loop: we iterate over the number of points for which we want to compute the positions, plus one to include the last point. We first determine the angle of each point, between the starting and ending angles.