54 lines
1.1 KiB
GDScript
54 lines
1.1 KiB
GDScript
|
extends Node2D
|
||
|
|
||
|
@export var initial = false
|
||
|
|
||
|
var activated = false
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
pass # Replace with function body.
|
||
|
|
||
|
|
||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||
|
func _process(_delta):
|
||
|
pass
|
||
|
|
||
|
func _draw():
|
||
|
var center = $Marker2D.position
|
||
|
var rad = 96
|
||
|
var x = -PI/5
|
||
|
var y = -PI/12
|
||
|
|
||
|
var A = center + get_point(-PI/2 - x) * rad
|
||
|
var B = center + get_point(0 - y) * rad
|
||
|
var C = center + get_point(PI/2) * rad
|
||
|
var D = center + get_point(PI + y) * rad
|
||
|
var E = center + get_point(-PI/2 + x) * rad
|
||
|
|
||
|
var color = Color.DARK_RED
|
||
|
var thick = 4
|
||
|
|
||
|
if self.activated:
|
||
|
color = Color.RED
|
||
|
thick = 16
|
||
|
|
||
|
if self.initial:
|
||
|
color = Color.BLUE_VIOLET
|
||
|
thick = 4
|
||
|
|
||
|
draw_line(A, C, color, thick)
|
||
|
draw_line(C, E, color, thick)
|
||
|
draw_line(E, B, color, thick)
|
||
|
draw_line(B, D, color, thick)
|
||
|
draw_line(D, A, color, thick)
|
||
|
|
||
|
func get_point(angle):
|
||
|
return Vector2(cos(angle), sin(angle))
|
||
|
|
||
|
func try_activate():
|
||
|
if self.initial:
|
||
|
return false
|
||
|
self.activated = true
|
||
|
self.queue_redraw()
|
||
|
return true
|