mirror of
https://github.com/creyD/ludum_dare_46.git
synced 2026-06-15 06:42:22 +02:00
You can now play cards!
- Fixed invalid scripts - Added card placement validation Co-Authored-By: deranonymos <deranonymos@users.noreply.github.com>
This commit is contained in:
@@ -1,31 +1,12 @@
|
||||
[gd_scene load_steps=2 format=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) == typeof(PackedScene)
|
||||
|
||||
|
||||
func get_nearest_grid_pos(position):
|
||||
return Vector2(floor(position.x / 32.0) * 32, floor(position.y / 32.0) * 32)
|
||||
|
||||
|
||||
#what is to be done when data is dropped
|
||||
func drop_data(_pos, data:PackedScene):
|
||||
var child = data.instance()
|
||||
child.position = get_nearest_grid_pos(_pos)
|
||||
get_node(get_parent().ObjectParent).add_child(child)
|
||||
"
|
||||
[ext_resource path="res://Menus/DragNDrop/DragSink.gd" type="Script" id=1]
|
||||
|
||||
[node name="DragSink" type="Container"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.789
|
||||
margin_bottom = -0.0200043
|
||||
script = SubResource( 1 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user