Added basic build menu and placement

This commit is contained in:
2024-03-06 09:25:28 -06:00
parent abde90e75f
commit ca8cfee1e8
25 changed files with 377 additions and 27 deletions

View File

@@ -0,0 +1,14 @@
[gd_resource type="Resource" script_class="BuildingGroup" load_steps=4 format=3 uid="uid://cfeob1arfvw6p"]
[ext_resource type="Script" path="res://data/buildings/building_group.gd" id="1_5u0lh"]
[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="1_hpowi"]
[sub_resource type="AtlasTexture" id="AtlasTexture_24mqt"]
atlas = ExtResource("1_hpowi")
region = Rect2(1088, 576, 64, 64)
[resource]
script = ExtResource("1_5u0lh")
name = "Advanced"
atlas_texture = SubResource("AtlasTexture_24mqt")
buildings = Array[Resource("res://data/buildings/building.gd")]([])

View File

@@ -0,0 +1,16 @@
[gd_resource type="Resource" script_class="BuildingGroup" load_steps=6 format=3 uid="uid://dqv53okb3evb7"]
[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="1_p1crr"]
[ext_resource type="Script" path="res://data/buildings/building_group.gd" id="1_xphre"]
[ext_resource type="Resource" uid="uid://d38xgwstvtcm4" path="res://data/buildings/basic/harvester_building.tres" id="2_7d7fa"]
[ext_resource type="Resource" uid="uid://cta6ngelbwo8b" path="res://data/buildings/basic/warehouse_building.tres" id="3_vxs34"]
[sub_resource type="AtlasTexture" id="AtlasTexture_nleix"]
atlas = ExtResource("1_p1crr")
region = Rect2(1024, 576, 64, 64)
[resource]
script = ExtResource("1_xphre")
name = "Basic"
atlas_texture = SubResource("AtlasTexture_nleix")
buildings = Array[Resource("res://data/buildings/building.gd")]([ExtResource("2_7d7fa"), ExtResource("3_vxs34")])

View File

@@ -0,0 +1,18 @@
[gd_resource type="Resource" script_class="Building" load_steps=5 format=3 uid="uid://d38xgwstvtcm4"]
[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="1_8uuv4"]
[ext_resource type="Script" path="res://data/buildings/building.gd" id="1_s0c8c"]
[ext_resource type="Resource" uid="uid://bpjj0x7jr1k6u" path="res://data/game_resources/carbon/carbon_resource.tres" id="2_ppxqc"]
[sub_resource type="AtlasTexture" id="AtlasTexture_5nxx0"]
atlas = ExtResource("1_8uuv4")
region = Rect2(1088, 128, 64, 64)
[resource]
script = ExtResource("1_s0c8c")
atlas_texture = SubResource("AtlasTexture_5nxx0")
name = "Harvester"
description = "Harvests nearby"
cost = {
ExtResource("2_ppxqc"): 100
}

View File

@@ -0,0 +1,20 @@
[gd_resource type="Resource" script_class="Building" load_steps=6 format=3 uid="uid://cta6ngelbwo8b"]
[ext_resource type="Texture2D" uid="uid://n806c03hgaq1" path="res://assets/scifi_tilesheet@2.png" id="1_24f36"]
[ext_resource type="Script" path="res://data/buildings/building.gd" id="1_aylgh"]
[ext_resource type="Resource" uid="uid://bpjj0x7jr1k6u" path="res://data/game_resources/carbon/carbon_resource.tres" id="2_s5ve8"]
[ext_resource type="Resource" uid="uid://dr00rd4f42jqe" path="res://data/game_resources/gem/gem_resource.tres" id="3_y57vu"]
[sub_resource type="AtlasTexture" id="AtlasTexture_pbx2g"]
atlas = ExtResource("1_24f36")
region = Rect2(1024, 64, 64, 64)
[resource]
script = ExtResource("1_aylgh")
atlas_texture = SubResource("AtlasTexture_pbx2g")
name = "Warehouse"
description = "Allows storage of more materials"
cost = {
ExtResource("2_s5ve8"): 500,
ExtResource("3_y57vu"): 200
}

View File

@@ -0,0 +1,7 @@
class_name Building
extends Resource
@export var atlas_texture: AtlasTexture
@export var name: String
@export var description: String
@export var cost: Dictionary

View File

@@ -0,0 +1,13 @@
extends Node2D
class_name BuildingBase
var _building_data: Building
@onready var sprite_2d: Sprite2D = $Sprite2D
func initialize(data: Building, grid_location: Vector2i) -> void:
_building_data = data
position = Grid.grid_to_world_center(grid_location)
func _ready() -> void:
sprite_2d.texture = _building_data.atlas_texture

View File

@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=3 uid="uid://kij6k2k1rmxb"]
[ext_resource type="Script" path="res://data/buildings/building_base.gd" id="1_odhat"]
[node name="BuildingBase" type="Node2D"]
script = ExtResource("1_odhat")
[node name="Sprite2D" type="Sprite2D" parent="."]

View File

@@ -0,0 +1,7 @@
extends Resource
class_name BuildingGroup
@export var name: String
@export var atlas_texture: AtlasTexture
@export var buildings: Array[Building]

View File

@@ -1,12 +1,11 @@
[gd_resource type="Resource" script_class="Building" load_steps=4 format=3 uid="uid://bgwoy0uh2cpvu"]
[ext_resource type="Resource" uid="uid://bpjj0x7jr1k6u" path="res://data/game_resources/carbon/carbon_resource.tres" id="1_5s38g"]
[ext_resource type="Script" path="res://scripts/building.gd" id="1_ssts7"]
[ext_resource type="Resource" uid="uid://dr00rd4f42jqe" path="res://data/game_resources/gem/gem_resource.tres" id="2_u1tpw"]
[ext_resource type="Script" path="res://data/buildings/building.gd" id="3_bd7jk"]
[resource]
script = ExtResource("1_ssts7")
atlas_texture_region = Vector2i(14, 7)
script = ExtResource("3_bd7jk")
name = "Corruptor"
description = "A building which only functions to spread corruption, and does it well"
cost = {

View File

@@ -1,16 +1,10 @@
[gd_resource type="Resource" script_class="Building" load_steps=5 format=3 uid="uid://c6vv3hyn5sd7o"]
[gd_resource type="Resource" script_class="Building" load_steps=3 format=3 uid="uid://c6vv3hyn5sd7o"]
[ext_resource type="Script" path="res://scripts/expansion_patterns/expansion_square_pattern.gd" id="1_attvt"]
[ext_resource type="Script" path="res://scripts/building.gd" id="1_ssd30"]
[ext_resource type="Script" path="res://data/buildings/building.gd" id="1_ssd30"]
[ext_resource type="Resource" uid="uid://bpjj0x7jr1k6u" path="res://data/game_resources/carbon/carbon_resource.tres" id="2_d8jrj"]
[sub_resource type="Resource" id="Resource_nqpn0"]
script = ExtResource("1_attvt")
[resource]
script = ExtResource("1_ssd30")
corruption_pattern = SubResource("Resource_nqpn0")
atlas_texture_region = Vector2i(17, 7)
name = "Hub"
description = "Main cheap base that corrupts a square"
cost = {