Dropping into the Dropsink now creates an instance of the given scene

This commit is contained in:
Streamfire
2020-04-18 21:05:59 +02:00
parent c461869511
commit 909be00d6e
3 changed files with 20 additions and 14 deletions

View File

@@ -1,23 +1,25 @@
[gd_scene load_steps=2 format=2]
[sub_resource type="GDScript" id=2]
[sub_resource type="GDScript" id=1]
script/source = "extends Container
#DropZone
#stuff can be dropped here
func can_drop_data(_pos, data):
return typeof(data) == TYPE_INT
return typeof(data) == typeof(PackedScene)
#what is to be done when data is dropped
func drop_data(_pos, data):
print(data)
func drop_data(_pos, data:PackedScene):
var child = data.instance()
child.position= _pos
self.add_child(child)
"
[node name="DragSink" type="Container"]
anchor_right = 1.0
anchor_bottom = 0.789
margin_bottom = -0.0200043
script = SubResource( 2 )
script = SubResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}