Skip to content

Commit 6c6811b

Browse files
authored
Small fix in Custom drawing for 2D
Change Vector2Array to PoolVector2Array
1 parent b3eadbc commit 6c6811b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tutorials/2d/custom_drawing_in_2d.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Basically, drawing a shape on screen requires it to be decomposed into a certain
112112

113113
func draw_circle_arc(center, radius, angle_from, angle_to, color):
114114
var nb_points = 32
115-
var points_arc = Vector2Array()
115+
var points_arc = PoolVector2Array()
116116
117117
for i in range(nb_points+1):
118118
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
122122
for index_point in range(nb_points):
123123
draw_line(points_arc[index_point], points_arc[index_point + 1], color)
124124

125-
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.
125+
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.
126126

127127
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.
128128

0 commit comments

Comments
 (0)