21 lines
586 B (Stored with Git LFS)
GDScript3
21 lines
586 B (Stored with Git LFS)
GDScript3
extends Container
|
|
|
|
|
|
# Declare member variables here. Examples:
|
|
# var a = 2
|
|
# var b = "text"
|
|
|
|
export var caption = ""
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
$Label.text = caption
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(_delta):
|
|
var areas = $Area2D.get_overlapping_areas()
|
|
if areas.size() == 1:
|
|
var parent = areas[0].get_parent()
|
|
if not parent.snap_position == null and Input.is_action_just_released("click"):
|
|
parent.snap_position = parent.rect_position
|