place_buildings #24

Merged
Ategon merged 5 commits from place_buildings into main 2024-09-11 23:21:23 +00:00
3 changed files with 18 additions and 1 deletions
Showing only changes of commit 781e9a452a - Show all commits

View file

@ -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

6
Test_Building.tscn Normal file
View file

@ -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")

9
main.gd Normal file
View file

@ -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)