Frame-of-Mind/src/DropZone.gd
2022-09-08 17:27:59 +02:00

24 lines
645 B (Stored with Git LFS)
GDScript3

extends Container
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
export(String) var caption
export(Texture) var texture
# Called when the node enters the scene tree for the first time.
func _ready():
$Label.text = caption
$TextureRect.texture = texture
# 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 "snap_position" in parent and Input.is_action_just_released("click"):
parent.snap_position = parent.rect_position