📜  godotpolygone2d 轮廓厚度 - 无论代码示例

📅  最后修改于: 2022-03-11 14:58:37.337000             🧑  作者: Mango

代码示例1
tool
extends Polygon2D

export(Color) var OutLine = Color(0,0,0) setget set_color
export(float) var Width = 2.0 setget set_width

func _draw():
    var poly = get_polygon()
    for i in range(1 , poly.size()):
        draw_line(poly[i-1] , poly[i], OutLine , Width)
    draw_line(poly[poly.size() - 1] , poly[0], OutLine , Width)

func set_color(color):
    OutLine = color
    update()

func set_width(new_width):
    Width = new_width
    update()