29 lines
708 B
GDScript
29 lines
708 B
GDScript
extends Area2D
|
|
|
|
var contained_nodes : Array = []
|
|
var points : Array = []
|
|
const LINE_THICC = 6.0
|
|
|
|
var is_error : bool = false
|
|
|
|
func _ready() -> void:
|
|
$PolygonCollision.polygon = points
|
|
$InkWellGood.points = PackedVector2Array(points)
|
|
if is_error:
|
|
$InkWellBad.points = $InkWellGood.points
|
|
$InkWellGood.visible = false
|
|
$InkWellBad.visible = true
|
|
await get_tree().create_timer(0.2).timeout
|
|
self.remove()
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
contained_nodes.append(body)
|
|
|
|
func get_contained_nodes() -> Array:
|
|
return contained_nodes
|
|
|
|
func remove() -> void:
|
|
if is_error:
|
|
await get_tree().create_tween().tween_property($InkWellBad, "width", 0.0, 0.5).finished
|
|
get_tree().queue_delete(self)
|