Frame-of-Mind/src/DropZone.gd

29 lines
751 B
GDScript3

extends Container
tool
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
export(String) var caption setget set_caption
export(Texture) var texture setget set_texture
func set_caption(cap:String):
$Label.text = cap
func set_texture(tex:Texture):
$TextureRect.texture = tex
# Called when the node enters the scene tree for the first time.
func _ready():
pass
# 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