Last active
April 24, 2019 02:57
-
-
Save lukewilson2002/b99d81331ca8031d08224367e832ca00 to your computer and use it in GitHub Desktop.
Unfilled cicle script for GDScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func draw_unfilled_circle(circle_center: Vector2, radius: float, color: Color, width = 1, resolution: float = 1): | |
var draw_counter = 1.0 | |
var vec_radius = Vector2(radius, 0) | |
var line_origin = vec_radius + circle_center | |
var line_end = Vector2() | |
while draw_counter <= 360.0: | |
line_end = vec_radius.rotated(deg2rad(draw_counter)) + circle_center | |
draw_line(line_origin, line_end, color, width) | |
draw_counter += 1.0 / resolution | |
line_origin = line_end | |
line_end = vec_radius.rotated(deg2rad(360)) + circle_center | |
draw_line(line_origin, line_end, color, width) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's an error and a few things that can be improved with this code. I'll update it with those improvements later.