Godot v4.2.1.stable
I am creating polygons next to eachother using Polygon2d. I want each polygon to have an outline. I am currently copying the points of the Polygon2d and then generating a line2d that serves as the outline. However, this outline (using the width variable in line2d) goes beyond the polygon and clips into the other nearby polygons. I want to keep the outline INSIDE the polygon. How would I do this?
Code of Polygon2d
extends Polygon2D
var claim: int
var troop_number: int
var continent: int
var claim_color
var temp_array = PackedVector2Array()
#var outline
Called when the node enters the scene tree for the first time.
func _ready():
claim_color = Color(0, 1, 0, 1)
color = claim_color
self_modulate.a = 0.25
var outline = Line2D.new()
add_child(outline)
outline.name = “Outline of {name}”.format({“name”: name})
outline.points = polygon
outline.default_color = claim_color
outline.self_modulate.a = 1
outline.closed = true
pass # Replace with function body.
Called every frame. ‘delta’ is the elapsed time since the previous frame.
func _process(delta):
pass