diff --git a/Main.tscn b/Main.tscn index 336395e..e6a4dec 100644 --- a/Main.tscn +++ b/Main.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=2 format=3 uid="uid://5ske2hm55rce"] +[gd_scene load_steps=3 format=3 uid="uid://5ske2hm55rce"] [ext_resource type="Theme" uid="uid://d035h7upxrw3h" path="res://theme.tres" id="1_xbn5h"] +[ext_resource type="Script" path="res://main.gd" id="1_xjws2"] [node name="Main" type="Node2D"] +script = ExtResource("1_xjws2") [node name="Control" type="Control" parent="."] layout_mode = 3 diff --git a/Test_Building.tscn b/Test_Building.tscn new file mode 100644 index 0000000..0db25ad --- /dev/null +++ b/Test_Building.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://bxf8c2vnv1cs6"] + +[ext_resource type="Texture2D" uid="uid://bi03hh1ousovx" path="res://icon.svg" id="1_5dc4m"] + +[node name="TestBulding" type="Sprite2D"] +texture = ExtResource("1_5dc4m") diff --git a/main.gd b/main.gd new file mode 100644 index 0000000..938c332 --- /dev/null +++ b/main.gd @@ -0,0 +1,9 @@ +extends Node2D + +var test_building_scene: PackedScene = preload("res://Test_Building.tscn") + +func _process(_delta): + if Input.is_action_just_pressed("lclick"): + var test_building: Sprite2D = test_building_scene.instantiate() + test_building.position = get_global_mouse_position() + $".".add_child(test_building)