mirror of
https://github.com/creyD/ludum_dare_46.git
synced 2026-06-13 22:12:23 +02:00
DragDropUI added to world
This commit is contained in:
@@ -1,25 +1,49 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=8 format=2]
|
||||
|
||||
[ext_resource path="res://Menus/DragNDrop/DragSource.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://Menus/DragNDrop/DragSink.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Objects/Banana/Banana.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://testSprites/bannane.png" type="Texture" id=4]
|
||||
[ext_resource path="res://testSprites/falle.png" type="Texture" id=5]
|
||||
[ext_resource path="res://Objects/Traps/bear.tscn" type="PackedScene" id=6]
|
||||
|
||||
[sub_resource type="GDScript" id=1]
|
||||
script/source = "extends Control
|
||||
|
||||
export var ObjectParent:NodePath
|
||||
"
|
||||
|
||||
[node name="DragNDropUI" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -0.37735
|
||||
margin_right = -0.37735
|
||||
script = SubResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="DragSource" parent="." instance=ExtResource( 1 )]
|
||||
margin_left = 12.7532
|
||||
margin_top = 230.124
|
||||
margin_right = 44.7532
|
||||
margin_bottom = 262.124
|
||||
[node name="DragSourceBanana" parent="." instance=ExtResource( 1 )]
|
||||
margin_left = 13.5128
|
||||
margin_top = 238.668
|
||||
margin_right = 45.5128
|
||||
margin_bottom = 270.668
|
||||
texture = ExtResource( 4 )
|
||||
Item = ExtResource( 3 )
|
||||
PreviewIcon = ExtResource( 4 )
|
||||
|
||||
[node name="DragSourceFalle" parent="." instance=ExtResource( 1 )]
|
||||
margin_left = 45.5128
|
||||
margin_top = 238.668
|
||||
margin_right = 77.5128
|
||||
margin_bottom = 270.668
|
||||
texture = ExtResource( 5 )
|
||||
Item = ExtResource( 6 )
|
||||
PreviewIcon = ExtResource( 5 )
|
||||
|
||||
[node name="DragSink" parent="." instance=ExtResource( 2 )]
|
||||
margin_left = 1.19746
|
||||
margin_right = 1.19745
|
||||
anchor_right = 1.002
|
||||
anchor_bottom = 0.87
|
||||
margin_left = 1.0
|
||||
margin_right = 0.0399475
|
||||
margin_bottom = 0.0999756
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
script/source = "extends Container
|
||||
#DropZone
|
||||
|
||||
|
||||
#stuff can be dropped here
|
||||
func can_drop_data(_pos, data):
|
||||
return typeof(data) == typeof(PackedScene)
|
||||
@@ -12,7 +13,7 @@ func can_drop_data(_pos, data):
|
||||
func drop_data(_pos, data:PackedScene):
|
||||
var child = data.instance()
|
||||
child.position= _pos
|
||||
self.add_child(child)
|
||||
get_node(get_parent().ObjectParent).add_child(child)
|
||||
"
|
||||
|
||||
[node name="DragSink" type="Container"]
|
||||
|
||||
Reference in New Issue
Block a user