plant-builder working
This commit is contained in:
@@ -2,28 +2,32 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://dt2ip3pw2cboy" path="res://entities/plants/scripts/texture_builder/plant_texture_builder.gd" id="1_s8rsj"]
|
||||
[ext_resource type="Script" uid="uid://b3jwglylqdqtw" path="res://entities/plants/scripts/texture_builder/plant_part.gd" id="2_cfiqo"]
|
||||
[ext_resource type="Resource" uid="uid://bfyafiewcrjln" path="res://entities/plants/resources/plant_parts/Base1.tres" id="3_coupj"]
|
||||
[ext_resource type="Resource" uid="uid://bfyafiewcrjln" path="res://entities/plants/resources/plant_parts/Base1.tres" id="3_15wue"]
|
||||
[ext_resource type="Resource" uid="uid://7hrdkl6bf3o4" path="res://entities/plants/resources/plant_parts/Branch1.tres" id="4_ggud5"]
|
||||
[ext_resource type="Resource" uid="uid://bgh8a4xwc5stw" path="res://entities/plants/resources/plant_parts/Base2.tres" id="5_21cjy"]
|
||||
[ext_resource type="Resource" uid="uid://ceisi5yyie7to" path="res://entities/plants/resources/plant_parts/Branch2.tres" id="5_ufbqh"]
|
||||
[ext_resource type="Resource" uid="uid://cxiu8frk04b5i" path="res://entities/plants/resources/plant_parts/Branch3.tres" id="6_jbu3q"]
|
||||
[ext_resource type="Resource" uid="uid://53p5g07e3pb4" path="res://entities/plants/resources/plant_parts/Branch4.tres" id="7_21cjy"]
|
||||
[ext_resource type="Resource" uid="uid://cyfyodtfxne1w" path="res://entities/plants/resources/plant_parts/Branch5.tres" id="8_qm7aw"]
|
||||
[ext_resource type="Resource" uid="uid://cuvtf4y1dspcp" path="res://entities/plants/resources/plant_parts/Branch6.tres" id="9_3e4c1"]
|
||||
[ext_resource type="Resource" uid="uid://6jnbms553dyd" path="res://entities/plants/resources/plant_parts/Branch7.tres" id="10_hyb2i"]
|
||||
[ext_resource type="Resource" uid="uid://bkpe0b38m0prg" path="res://entities/plants/resources/plant_parts/Branch8.tres" id="11_4gk8a"]
|
||||
[ext_resource type="Resource" uid="uid://wgmxpk52rg7x" path="res://entities/plants/resources/plant_parts/LeafA1.tres" id="11_fc4k8"]
|
||||
[ext_resource type="Resource" uid="uid://d2y7o2hc6ffei" path="res://entities/plants/resources/plant_parts/Branch11.tres" id="11_hvwgo"]
|
||||
[ext_resource type="Resource" uid="uid://cbejb0uvdke7k" path="res://entities/plants/resources/plant_parts/LeafA2.tres" id="12_1b4fr"]
|
||||
[ext_resource type="Resource" uid="uid://31oq17bv1t4t" path="res://entities/plants/resources/plant_parts/Branch9.tres" id="12_alra6"]
|
||||
[ext_resource type="Resource" uid="uid://civ4gr1c2pq7g" path="res://entities/plants/resources/plant_parts/Branch12.tres" id="12_npk80"]
|
||||
[ext_resource type="Resource" uid="uid://dujxttu80g0lo" path="res://entities/plants/resources/plant_parts/LeafA3.tres" id="13_ggcwy"]
|
||||
[ext_resource type="Resource" uid="uid://b68fyu1j5d6te" path="res://entities/plants/resources/plant_parts/Branch10.tres" id="13_lggh7"]
|
||||
[ext_resource type="Resource" uid="uid://bqfocs6f0iypo" path="res://entities/plants/resources/plant_parts/Branch13.tres" id="13_hyb2i"]
|
||||
[ext_resource type="Resource" uid="uid://drml5dm8i3j3a" path="res://entities/plants/resources/plant_parts/Branch14.tres" id="14_4gk8a"]
|
||||
[ext_resource type="Resource" uid="uid://bgv3nb10t6u3y" path="res://entities/plants/resources/plant_parts/LeafF1.tres" id="14_8r35x"]
|
||||
[ext_resource type="Resource" uid="uid://bix3qwmsvuxs4" path="res://entities/plants/resources/plant_parts/LeafA4.tres" id="14_15wue"]
|
||||
[ext_resource type="Resource" uid="uid://c31h25xdll8si" path="res://entities/plants/resources/plant_parts/FlowerD1.tres" id="15_3ti7v"]
|
||||
[ext_resource type="Resource" uid="uid://be17y7clvf88e" path="res://entities/plants/resources/plant_parts/LeafE1.tres" id="15_p2blu"]
|
||||
[ext_resource type="Resource" uid="uid://bkgw3wmoam10n" path="res://entities/plants/resources/plant_parts/LeafF2.tres" id="15_rbd7l"]
|
||||
[ext_resource type="Script" uid="uid://cfjd8jelpm8dt" path="res://entities/plants/scripts/texture_builder/part_mutation_association.gd" id="16_c3tk3"]
|
||||
[ext_resource type="Resource" uid="uid://r5mspvasrq6y" path="res://entities/plants/resources/plant_parts/FlowerD2.tres" id="16_cpf4r"]
|
||||
[ext_resource type="Resource" uid="uid://m8j2gfumw11w" path="res://entities/plants/resources/plant_parts/LeafF3.tres" id="16_nfxo0"]
|
||||
[ext_resource type="Resource" uid="uid://dw7wdihxxy0uf" path="res://entities/plants/resources/plant_parts/LeafE2.tres" id="16_xt8tm"]
|
||||
[ext_resource type="Resource" uid="uid://dth4dp88vs3gh" path="res://entities/plants/resources/plant_parts/LeafF4.tres" id="17_i8j71"]
|
||||
[ext_resource type="Resource" uid="uid://br80voioh4jxu" path="res://entities/plants/resources/plant_parts/FlowerD3.tres" id="17_p2blu"]
|
||||
[ext_resource type="Resource" uid="uid://3yi8hk73s5mm" path="res://entities/plants/resources/plant_parts/LeafE3.tres" id="17_qm7aw"]
|
||||
[ext_resource type="Resource" uid="uid://cka6sihumbjpw" path="res://entities/plants/resources/plant_parts/LeafF5.tres" id="18_l2vrg"]
|
||||
[ext_resource type="Resource" uid="uid://dq5dwqherb6ac" path="res://entities/plants/resources/plant_parts/LeafF6.tres" id="19_14c4k"]
|
||||
@@ -31,15 +35,10 @@
|
||||
[ext_resource type="Resource" uid="uid://dhhyh56shnure" path="res://entities/plants/resources/plant_parts/FlowerF2.tres" id="21_8r35x"]
|
||||
[ext_resource type="Resource" uid="uid://banfc3pgm6a0m" path="res://entities/plants/resources/plant_parts/FlowerC1.tres" id="21_alra6"]
|
||||
[ext_resource type="Resource" uid="uid://dmdyj7t4g48p" path="res://entities/plants/resources/plant_parts/FlowerC2.tres" id="22_lggh7"]
|
||||
[ext_resource type="Resource" uid="uid://cowkewtw2lg4i" path="res://entities/plants/resources/plant_parts/FlowerA1.tres" id="22_rbd7l"]
|
||||
[ext_resource type="Resource" uid="uid://bhj7j78tokt25" path="res://entities/plants/resources/plant_parts/FlowerC3.tres" id="23_8r35x"]
|
||||
[ext_resource type="Resource" uid="uid://drn8vt4sp7u6q" path="res://entities/plants/resources/plant_parts/FlowerA2.tres" id="23_nfxo0"]
|
||||
[ext_resource type="Resource" uid="uid://b3oqeugtrtera" path="res://entities/plants/resources/plant_parts/FlowerA3.tres" id="24_i8j71"]
|
||||
[ext_resource type="Resource" uid="uid://bkgrwffi7m2i4" path="res://entities/plants/resources/plant_parts/FlowerC4.tres" id="24_rbd7l"]
|
||||
[ext_resource type="Resource" uid="uid://ydvnxfnkbr2g" path="res://entities/plants/resources/plant_parts/FlowerA4.tres" id="25_l2vrg"]
|
||||
[ext_resource type="Resource" uid="uid://bchwhdmxsaqic" path="res://entities/plants/resources/plant_parts/LeafA5.tres" id="29_nfxo0"]
|
||||
[ext_resource type="Resource" uid="uid://cvr81iqokda6x" path="res://entities/plants/resources/plant_parts/LeafA6.tres" id="30_i8j71"]
|
||||
[ext_resource type="Resource" uid="uid://dl1k0jv662m67" path="res://entities/plants/resources/plant_parts/FlowerA5.tres" id="35_l2vrg"]
|
||||
[ext_resource type="Resource" uid="uid://cwskfwdasvv0g" path="res://entities/plants/resources/plant_parts/FlowerF3.tres" id="38_rbd7l"]
|
||||
[ext_resource type="Resource" uid="uid://e0u1baixvaxn" path="res://entities/plants/resources/plant_parts/LeafE4.tres" id="42_14c4k"]
|
||||
[ext_resource type="Resource" uid="uid://dgivyissl512e" path="res://entities/plants/resources/plant_parts/LeafG1.tres" id="43_y02ao"]
|
||||
@@ -48,12 +47,6 @@
|
||||
[ext_resource type="Resource" uid="uid://b3dfua388ub4k" path="res://entities/plants/resources/plant_parts/FlowerB2.tres" id="46_ggud5"]
|
||||
[ext_resource type="Resource" uid="uid://bnn0tcoab4plv" path="res://entities/plants/resources/plant_parts/FlowerB3.tres" id="47_ufbqh"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_14c4k"]
|
||||
script = ExtResource("16_c3tk3")
|
||||
parts = Array[ExtResource("2_cfiqo")]([ExtResource("21_alra6"), ExtResource("22_lggh7"), ExtResource("23_8r35x"), ExtResource("24_rbd7l")])
|
||||
part_amount = 4
|
||||
metadata/_custom_type_script = "uid://cfjd8jelpm8dt"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_rt6tw"]
|
||||
script = ExtResource("16_c3tk3")
|
||||
parts = Array[ExtResource("2_cfiqo")]([ExtResource("11_fc4k8"), ExtResource("12_1b4fr"), ExtResource("13_ggcwy"), ExtResource("14_15wue"), ExtResource("29_nfxo0"), ExtResource("30_i8j71")])
|
||||
@@ -62,7 +55,7 @@ metadata/_custom_type_script = "uid://cfjd8jelpm8dt"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_y02ao"]
|
||||
script = ExtResource("16_c3tk3")
|
||||
parts = Array[ExtResource("2_cfiqo")]([ExtResource("22_rbd7l"), ExtResource("23_nfxo0"), ExtResource("24_i8j71"), ExtResource("25_l2vrg"), ExtResource("35_l2vrg")])
|
||||
parts = Array[ExtResource("2_cfiqo")]([ExtResource("15_3ti7v"), ExtResource("16_cpf4r"), ExtResource("17_p2blu")])
|
||||
part_amount = 5
|
||||
metadata/_custom_type_script = "uid://cfjd8jelpm8dt"
|
||||
|
||||
@@ -78,6 +71,12 @@ parts = Array[ExtResource("2_cfiqo")]([ExtResource("15_p2blu"), ExtResource("16_
|
||||
part_amount = 5
|
||||
metadata/_custom_type_script = "uid://cfjd8jelpm8dt"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_14c4k"]
|
||||
script = ExtResource("16_c3tk3")
|
||||
parts = Array[ExtResource("2_cfiqo")]([ExtResource("21_alra6"), ExtResource("22_lggh7"), ExtResource("23_8r35x"), ExtResource("24_rbd7l")])
|
||||
part_amount = 4
|
||||
metadata/_custom_type_script = "uid://cfjd8jelpm8dt"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_cfiqo"]
|
||||
script = ExtResource("16_c3tk3")
|
||||
parts = Array[ExtResource("2_cfiqo")]([ExtResource("43_y02ao"), ExtResource("44_s8rsj")])
|
||||
@@ -92,8 +91,9 @@ metadata/_custom_type_script = "uid://cfjd8jelpm8dt"
|
||||
|
||||
[node name="TextureBuilder" type="Node" unique_id=79184097]
|
||||
script = ExtResource("1_s8rsj")
|
||||
bases = Array[ExtResource("2_cfiqo")]([ExtResource("3_coupj")])
|
||||
branches = Array[ExtResource("2_cfiqo")]([ExtResource("4_ggud5"), ExtResource("5_ufbqh"), ExtResource("6_jbu3q"), ExtResource("7_21cjy"), ExtResource("8_qm7aw"), ExtResource("9_3e4c1"), ExtResource("10_hyb2i"), ExtResource("11_4gk8a"), ExtResource("12_alra6"), ExtResource("13_lggh7")])
|
||||
bases = Array[ExtResource("2_cfiqo")]([ExtResource("3_15wue")])
|
||||
baby_bases = Array[ExtResource("2_cfiqo")]([ExtResource("5_21cjy")])
|
||||
branches = Array[ExtResource("2_cfiqo")]([ExtResource("4_ggud5"), ExtResource("5_ufbqh"), ExtResource("6_jbu3q"), ExtResource("7_21cjy"), ExtResource("8_qm7aw"), ExtResource("9_3e4c1"), ExtResource("11_hvwgo"), ExtResource("12_npk80"), ExtResource("13_hyb2i"), ExtResource("14_4gk8a")])
|
||||
n_branches = 5
|
||||
base_leaves = Array[ExtResource("2_cfiqo")]([ExtResource("14_8r35x"), ExtResource("15_rbd7l"), ExtResource("16_nfxo0"), ExtResource("17_i8j71"), ExtResource("18_l2vrg"), ExtResource("19_14c4k")])
|
||||
parts_mutation_associations = Dictionary[String, ExtResource("16_c3tk3")]({
|
||||
@@ -105,3 +105,9 @@ parts_mutation_associations = Dictionary[String, ExtResource("16_c3tk3")]({
|
||||
"SOCIAL": SubResource("Resource_cfiqo"),
|
||||
"TOUGH": SubResource("Resource_jbu3q")
|
||||
})
|
||||
chance_to_have_part = 0.9
|
||||
origin_weights_base = Dictionary[int, int]({
|
||||
0: 20,
|
||||
1: 10,
|
||||
2: 5
|
||||
})
|
||||
|
||||
BIN
entities/plants/assets/sprites/asset-plante-fin_assemble.pdn
Normal file
BIN
entities/plants/assets/sprites/asset-plante-fin_assemble.pdn
Normal file
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 MiB After Width: | Height: | Size: 2.7 MiB |
@@ -6,18 +6,18 @@
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yh7e0"]
|
||||
atlas = ExtResource("1_yh7e0")
|
||||
region = Rect2(2118, 923, 371, 391)
|
||||
region = Rect2(937, 836, 309, 407)
|
||||
|
||||
[node name="Sprite" type="Sprite2D" unique_id=1642167049 node_paths=PackedStringArray("root", "attaches")]
|
||||
texture = SubResource("AtlasTexture_yh7e0")
|
||||
script = ExtResource("2_a5yje")
|
||||
part_name = "LeafG3"
|
||||
part_name = "LeafG1"
|
||||
type = 1
|
||||
root = NodePath("Root")
|
||||
attaches = NodePath("Attaches")
|
||||
|
||||
[node name="Root" type="Node2D" parent="." unique_id=1437082577]
|
||||
position = Vector2(-138, 138)
|
||||
position = Vector2(116, 172)
|
||||
script = ExtResource("3_yh7e0")
|
||||
attach_types = Array[int]([1, 3])
|
||||
metadata/_custom_type_script = "uid://d01kj3twwcrmu"
|
||||
|
||||
@@ -102,6 +102,7 @@ script = ExtResource("1_pq8o7")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="." unique_id=1693882598]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(0, -100)
|
||||
scale = Vector2(0.15, 0.15)
|
||||
|
||||
[node name="PlantedSeed" type="Sprite2D" parent="Sprite" unique_id=1134686525]
|
||||
|
||||
File diff suppressed because one or more lines are too long
40
entities/plants/resources/plant_parts/Base2.tres
Normal file
40
entities/plants/resources/plant_parts/Base2.tres
Normal file
@@ -0,0 +1,40 @@
|
||||
[gd_resource type="Resource" script_class="PlantPart" format=3 uid="uid://bgh8a4xwc5stw"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://co46ywm8bgnfh" path="res://entities/plants/scripts/texture_builder/plant_attach.gd" id="1_fpg0h"]
|
||||
[ext_resource type="Script" uid="uid://b3jwglylqdqtw" path="res://entities/plants/scripts/texture_builder/plant_part.gd" id="2_ex0x2"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxnm1quxhx40i" path="res://entities/plants/assets/sprites/asset-plante-fin_assemble.png" id="3_lfxw0"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_uf3kp"]
|
||||
script = ExtResource("1_fpg0h")
|
||||
position = Vector2(9, 45)
|
||||
attach_types = Array[int]([1])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_hbst6"]
|
||||
script = ExtResource("1_fpg0h")
|
||||
position = Vector2(22, -118)
|
||||
attach_types = Array[int]([2, 3])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_w4gue"]
|
||||
script = ExtResource("1_fpg0h")
|
||||
position = Vector2(56, -169)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_gvdal"]
|
||||
script = ExtResource("1_fpg0h")
|
||||
position = Vector2(-22, -190)
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_ctxsc"]
|
||||
script = ExtResource("1_fpg0h")
|
||||
position = Vector2(-31, 228)
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_khbsd"]
|
||||
atlas = ExtResource("3_lfxw0")
|
||||
region = Rect2(75, 836, 184, 463)
|
||||
|
||||
[resource]
|
||||
resource_name = "Base2"
|
||||
script = ExtResource("2_ex0x2")
|
||||
texture = SubResource("AtlasTexture_khbsd")
|
||||
root = SubResource("Resource_ctxsc")
|
||||
attaches = Array[ExtResource("1_fpg0h")]([SubResource("Resource_uf3kp"), SubResource("Resource_hbst6"), SubResource("Resource_w4gue"), SubResource("Resource_gvdal")])
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
36
entities/plants/resources/plant_parts/Branch11.tres
Normal file
36
entities/plants/resources/plant_parts/Branch11.tres
Normal file
@@ -0,0 +1,36 @@
|
||||
[gd_resource type="Resource" script_class="PlantPart" format=3 uid="uid://d2y7o2hc6ffei"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://co46ywm8bgnfh" path="res://entities/plants/scripts/texture_builder/plant_attach.gd" id="1_smg8i"]
|
||||
[ext_resource type="Script" uid="uid://b3jwglylqdqtw" path="res://entities/plants/scripts/texture_builder/plant_part.gd" id="2_0o4uq"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxnm1quxhx40i" path="res://entities/plants/assets/sprites/asset-plante-fin_assemble.png" id="3_ii5p4"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_83gik"]
|
||||
script = ExtResource("1_smg8i")
|
||||
position = Vector2(58, 62)
|
||||
attach_types = Array[int]([1, 3])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_dtp6r"]
|
||||
script = ExtResource("1_smg8i")
|
||||
position = Vector2(-48, -70)
|
||||
attach_types = Array[int]([1, 3])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_7vl6a"]
|
||||
script = ExtResource("1_smg8i")
|
||||
position = Vector2(-137, -105)
|
||||
attach_types = Array[int]([2, 3])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_yhbk0"]
|
||||
script = ExtResource("1_smg8i")
|
||||
position = Vector2(140, 86)
|
||||
attach_types = Array[int]([0])
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_khbsd"]
|
||||
atlas = ExtResource("3_ii5p4")
|
||||
region = Rect2(142, 2522, 370, 282)
|
||||
|
||||
[resource]
|
||||
resource_name = "Branch11"
|
||||
script = ExtResource("2_0o4uq")
|
||||
texture = SubResource("AtlasTexture_khbsd")
|
||||
root = SubResource("Resource_yhbk0")
|
||||
attaches = Array[ExtResource("1_smg8i")]([SubResource("Resource_83gik"), SubResource("Resource_dtp6r"), SubResource("Resource_7vl6a")])
|
||||
36
entities/plants/resources/plant_parts/Branch12.tres
Normal file
36
entities/plants/resources/plant_parts/Branch12.tres
Normal file
@@ -0,0 +1,36 @@
|
||||
[gd_resource type="Resource" script_class="PlantPart" format=3 uid="uid://civ4gr1c2pq7g"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://co46ywm8bgnfh" path="res://entities/plants/scripts/texture_builder/plant_attach.gd" id="1_h0d20"]
|
||||
[ext_resource type="Script" uid="uid://b3jwglylqdqtw" path="res://entities/plants/scripts/texture_builder/plant_part.gd" id="2_p8rhl"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxnm1quxhx40i" path="res://entities/plants/assets/sprites/asset-plante-fin_assemble.png" id="3_0ece1"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_y72ry"]
|
||||
script = ExtResource("1_h0d20")
|
||||
position = Vector2(50, -26)
|
||||
attach_types = Array[int]([1, 3])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_w8et7"]
|
||||
script = ExtResource("1_h0d20")
|
||||
position = Vector2(-110, -61)
|
||||
attach_types = Array[int]([1, 3])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_dkuwv"]
|
||||
script = ExtResource("1_h0d20")
|
||||
position = Vector2(-157, -72)
|
||||
attach_types = Array[int]([2, 3])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_i4sl3"]
|
||||
script = ExtResource("1_h0d20")
|
||||
position = Vector2(187, 79)
|
||||
attach_types = Array[int]([0])
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_khbsd"]
|
||||
atlas = ExtResource("3_0ece1")
|
||||
region = Rect2(83, 2912, 463, 251)
|
||||
|
||||
[resource]
|
||||
resource_name = "Branch12"
|
||||
script = ExtResource("2_p8rhl")
|
||||
texture = SubResource("AtlasTexture_khbsd")
|
||||
root = SubResource("Resource_i4sl3")
|
||||
attaches = Array[ExtResource("1_h0d20")]([SubResource("Resource_y72ry"), SubResource("Resource_w8et7"), SubResource("Resource_dkuwv")])
|
||||
36
entities/plants/resources/plant_parts/Branch13.tres
Normal file
36
entities/plants/resources/plant_parts/Branch13.tres
Normal file
@@ -0,0 +1,36 @@
|
||||
[gd_resource type="Resource" script_class="PlantPart" format=3 uid="uid://bqfocs6f0iypo"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://co46ywm8bgnfh" path="res://entities/plants/scripts/texture_builder/plant_attach.gd" id="1_iibe2"]
|
||||
[ext_resource type="Script" uid="uid://b3jwglylqdqtw" path="res://entities/plants/scripts/texture_builder/plant_part.gd" id="2_3j5ru"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxnm1quxhx40i" path="res://entities/plants/assets/sprites/asset-plante-fin_assemble.png" id="3_u12ix"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_2cpm3"]
|
||||
script = ExtResource("1_iibe2")
|
||||
position = Vector2(-31, 21)
|
||||
attach_types = Array[int]([1, 3])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_7thl0"]
|
||||
script = ExtResource("1_iibe2")
|
||||
position = Vector2(41, -17)
|
||||
attach_types = Array[int]([1, 3])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_2i6au"]
|
||||
script = ExtResource("1_iibe2")
|
||||
position = Vector2(138, -61)
|
||||
attach_types = Array[int]([2, 3])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_bg6ob"]
|
||||
script = ExtResource("1_iibe2")
|
||||
position = Vector2(-143, 52)
|
||||
attach_types = Array[int]([0])
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_khbsd"]
|
||||
atlas = ExtResource("3_u12ix")
|
||||
region = Rect2(112, 3279, 409, 215)
|
||||
|
||||
[resource]
|
||||
resource_name = "Branch13"
|
||||
script = ExtResource("2_3j5ru")
|
||||
texture = SubResource("AtlasTexture_khbsd")
|
||||
root = SubResource("Resource_bg6ob")
|
||||
attaches = Array[ExtResource("1_iibe2")]([SubResource("Resource_2cpm3"), SubResource("Resource_7thl0"), SubResource("Resource_2i6au")])
|
||||
36
entities/plants/resources/plant_parts/Branch14.tres
Normal file
36
entities/plants/resources/plant_parts/Branch14.tres
Normal file
@@ -0,0 +1,36 @@
|
||||
[gd_resource type="Resource" script_class="PlantPart" format=3 uid="uid://drml5dm8i3j3a"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://co46ywm8bgnfh" path="res://entities/plants/scripts/texture_builder/plant_attach.gd" id="1_0v6u4"]
|
||||
[ext_resource type="Script" uid="uid://b3jwglylqdqtw" path="res://entities/plants/scripts/texture_builder/plant_part.gd" id="2_sq3us"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxnm1quxhx40i" path="res://entities/plants/assets/sprites/asset-plante-fin_assemble.png" id="3_j5jc7"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_nqyym"]
|
||||
script = ExtResource("1_0v6u4")
|
||||
position = Vector2(-57, 49)
|
||||
attach_types = Array[int]([1, 3])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_mytka"]
|
||||
script = ExtResource("1_0v6u4")
|
||||
position = Vector2(47, -9)
|
||||
attach_types = Array[int]([1, 3])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_5hm5x"]
|
||||
script = ExtResource("1_0v6u4")
|
||||
position = Vector2(113, -50)
|
||||
attach_types = Array[int]([2, 3])
|
||||
|
||||
[sub_resource type="Resource" id="Resource_j68fk"]
|
||||
script = ExtResource("1_0v6u4")
|
||||
position = Vector2(-130, 47)
|
||||
attach_types = Array[int]([0])
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_khbsd"]
|
||||
atlas = ExtResource("3_j5jc7")
|
||||
region = Rect2(135, 3652, 362, 217)
|
||||
|
||||
[resource]
|
||||
resource_name = "Branch14"
|
||||
script = ExtResource("2_sq3us")
|
||||
texture = SubResource("AtlasTexture_khbsd")
|
||||
root = SubResource("Resource_j68fk")
|
||||
attaches = Array[ExtResource("1_0v6u4")]([SubResource("Resource_nqyym"), SubResource("Resource_mytka"), SubResource("Resource_5hm5x")])
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -2,16 +2,16 @@
|
||||
|
||||
[ext_resource type="Script" uid="uid://co46ywm8bgnfh" path="res://entities/plants/scripts/texture_builder/plant_attach.gd" id="1_t11x3"]
|
||||
[ext_resource type="Script" uid="uid://b3jwglylqdqtw" path="res://entities/plants/scripts/texture_builder/plant_part.gd" id="2_ojo42"]
|
||||
[ext_resource type="Texture2D" uid="uid://b7nfpxk8nfnov" path="res://entities/plants/assets/sprites/asset-plante-fin.png" id="3_anyn2"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxnm1quxhx40i" path="res://entities/plants/assets/sprites/asset-plante-fin_assemble.png" id="3_t11x3"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_t11x3"]
|
||||
script = ExtResource("1_t11x3")
|
||||
position = Vector2(-2, 6)
|
||||
attach_types = Array[int]([1])
|
||||
attach_types = Array[int]([2])
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yh7e0"]
|
||||
atlas = ExtResource("3_anyn2")
|
||||
region = Rect2(1934, 1007, 141, 142)
|
||||
atlas = ExtResource("3_t11x3")
|
||||
region = Rect2(2327, 981, 142, 150)
|
||||
|
||||
[resource]
|
||||
resource_name = "FlowerD2"
|
||||
|
||||
21
entities/plants/resources/plant_parts/FlowerD3.tres
Normal file
21
entities/plants/resources/plant_parts/FlowerD3.tres
Normal file
@@ -0,0 +1,21 @@
|
||||
[gd_resource type="Resource" script_class="PlantPart" format=3 uid="uid://br80voioh4jxu"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://co46ywm8bgnfh" path="res://entities/plants/scripts/texture_builder/plant_attach.gd" id="1_vh21j"]
|
||||
[ext_resource type="Script" uid="uid://b3jwglylqdqtw" path="res://entities/plants/scripts/texture_builder/plant_part.gd" id="2_5vhxt"]
|
||||
[ext_resource type="Texture2D" uid="uid://bxnm1quxhx40i" path="res://entities/plants/assets/sprites/asset-plante-fin_assemble.png" id="3_l52do"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_vh21j"]
|
||||
script = ExtResource("1_vh21j")
|
||||
position = Vector2(-2, 6)
|
||||
attach_types = Array[int]([2, 3])
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_yh7e0"]
|
||||
atlas = ExtResource("3_l52do")
|
||||
region = Rect2(2229, 1129, 192, 193)
|
||||
|
||||
[resource]
|
||||
resource_name = "FlowerD3"
|
||||
script = ExtResource("2_5vhxt")
|
||||
texture = SubResource("AtlasTexture_yh7e0")
|
||||
type = 1
|
||||
root = SubResource("Resource_vh21j")
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -25,7 +25,7 @@ func generate_plants():
|
||||
child.free()
|
||||
|
||||
for i in n_plants_to_generate:
|
||||
print("Generate plant")
|
||||
print("Generate plant :")
|
||||
var plant_pos_x = (i % n_plants_per_row) * space_between_plants
|
||||
@warning_ignore("integer_division")
|
||||
var plant_pos_y = (i / n_plants_per_row) * space_between_plants
|
||||
@@ -37,6 +37,7 @@ func generate_plants():
|
||||
for j in n_mutation_per_plant:
|
||||
plant_data.mutations.append(plant_data.archetype.available_mutations.pick_random())
|
||||
var plant: Plant = Plant.new(plant_data)
|
||||
print(plant.data.plant_name)
|
||||
%Plants.add_child(plant)
|
||||
plant.set_owner(self )
|
||||
plant.global_position = plant_position
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
extends Resource
|
||||
class_name PlantAttach
|
||||
|
||||
enum AttachType {ORANGE_ATTACH, PURPLE_ATTACH, BLUE_ATTACH, PINK_ATTACH}
|
||||
enum AttachType {BIG_ATTACH, MEDIUM_ATTACH, FLOWER_ATTACH, SMALL_ATTACH}
|
||||
|
||||
@export var position: Vector2
|
||||
@export var attach_types: Array[AttachType]
|
||||
|
||||
@@ -4,14 +4,20 @@ class_name PlantPart
|
||||
enum PartType {BASE_PART, BRANCH_PART, LEAF_PART, FLOWER_PART}
|
||||
|
||||
@export var texture: Texture
|
||||
@export var image: Image
|
||||
@export var type: PartType
|
||||
@export var root: PlantAttach
|
||||
@export var attaches: Array[PlantAttach] # array of vec2
|
||||
|
||||
var image: Image: get = get_image
|
||||
|
||||
func init(textute_arg: Texture, type_arg: PartType, root_arg: PlantAttach, attaches_arg: Array[PlantAttach]) -> void:
|
||||
texture = textute_arg
|
||||
image = texture.get_image()
|
||||
type = type_arg
|
||||
root = root_arg
|
||||
attaches = attaches_arg
|
||||
|
||||
func get_image():
|
||||
if image == null:
|
||||
image = texture.get_image()
|
||||
return image
|
||||
|
||||
@@ -1,19 +1,31 @@
|
||||
extends Node
|
||||
|
||||
const IMAGE_WIDTH := 1024
|
||||
const IMAGE_HEIGHT := 1048
|
||||
const IMAGE_WIDTH := 2048
|
||||
const IMAGE_HEIGHT := 2048
|
||||
|
||||
const PLACEHOLDER_SEED_TEXTURE: Texture = preload("res://entities/plants/assets/sprites/default/seed.png")
|
||||
const PLACEHOLDER_MATURE_TEXTURE: Texture = preload("res://entities/plants/assets/sprites/default/mature.png")
|
||||
const PLACEHOLDER_GROWING_TEXTURE: Texture = preload("res://entities/plants/assets/sprites/default/growing.png")
|
||||
|
||||
enum OriginType {BRANCH_ORIGIN, MUTATION_ORIGIN, BASE_LEAF_ORIGIN}
|
||||
|
||||
# @export var parts_archetype_associations: Dictionary[PlantArchetype, PartArchetypeAssociation] TODO:: have the archetypes
|
||||
@export var bases: Array[PlantPart]
|
||||
@export var baby_bases: Array[PlantPart]
|
||||
@export var branches: Array[PlantPart]
|
||||
@export var n_branches: int = 2
|
||||
@export var base_leaves: Array[PlantPart]
|
||||
@export var parts_mutation_associations: Dictionary[String, PartMutationAssociation]
|
||||
@export var parts_mutation_associations: Dictionary[String, PartMutationAssociation] # Array[PlantPart]
|
||||
|
||||
@export var chance_to_have_part := 0.75;
|
||||
|
||||
@export var origin_weights_base: Dictionary[OriginType, int] = {OriginType.BRANCH_ORIGIN: 10, OriginType.MUTATION_ORIGIN: 10, OriginType.BASE_LEAF_ORIGIN: 10}
|
||||
@export var origin_weight_loss := 3
|
||||
@export var origin_weight_gain := 1
|
||||
|
||||
@export var mutation_weight_base := 10
|
||||
@export var mutation_weight_loss := 3
|
||||
@export var mutation_weight_gain := 1
|
||||
|
||||
var rng := RandomNumberGenerator.new()
|
||||
var image: Image = Image.create_empty(IMAGE_WIDTH, IMAGE_HEIGHT, false, Image.FORMAT_RGBA8)
|
||||
@@ -33,105 +45,127 @@ func shuffle(array: Array):
|
||||
array[available_ind] = array[picked_ind]
|
||||
array[picked_ind] = temp
|
||||
|
||||
func shuffle_weighted(array: Array, weights: Array[int]):
|
||||
assert(array.size() == weights.size(), "Suffle with weights not same size")
|
||||
|
||||
var indices := range(array.size())
|
||||
var random_values: Array[int] = []
|
||||
for i in range(array.size()):
|
||||
random_values.append(rng.randi_range(0, weights[i]))
|
||||
|
||||
indices.sort_custom(func(a, b): return random_values[a] > random_values[b])
|
||||
|
||||
var originalArray := array.duplicate()
|
||||
var originalWeights := weights.duplicate()
|
||||
|
||||
for i in range(array.size()):
|
||||
array[i] = originalArray[indices[i]]
|
||||
weights[i] = originalWeights[indices[i]]
|
||||
|
||||
func build_seed_texture(_random_seed: int) -> Texture:
|
||||
return PLACEHOLDER_SEED_TEXTURE
|
||||
|
||||
func build_plant_texture(plant_data: PlantData) -> Texture:
|
||||
rng.seed = plant_data.random_seed
|
||||
|
||||
|
||||
var mature_texture: Texture = PLACEHOLDER_MATURE_TEXTURE
|
||||
var texture: Texture
|
||||
var base_part: PlantPart
|
||||
var base_image_coord: Vector2i
|
||||
var available_attaches: Array[PlantAttach]
|
||||
var parent_image_coords: Array[Vector2]
|
||||
var parts_to_place: Array[PlantPart]
|
||||
|
||||
match plant_data.get_state():
|
||||
PlantData.State.MATURE:
|
||||
# print("Build mature texture")
|
||||
# var plant_archetype := plant_data.archetype
|
||||
if bases.size() == 0:
|
||||
printerr("No base in archetype")
|
||||
return mature_texture
|
||||
# var base_part: PlantPart = pick_random(parts_archetype_associations[plant_archetype].bases)
|
||||
texture = PLACEHOLDER_MATURE_TEXTURE
|
||||
base_part = pick_random(bases)
|
||||
|
||||
var base_image := base_part.image
|
||||
var base_image_center: Vector2i = 0.5 * base_image.get_size()
|
||||
base_image_coord = image_center - Vector2i(base_part.root.position)
|
||||
image.blend_rect(base_image, Rect2i(Vector2i.ZERO, base_image.get_size()), base_image_coord - base_image_center)
|
||||
|
||||
if branches.size() == 0:
|
||||
printerr("No branches in archetype")
|
||||
# var branch_parts: Array[PlantPart] = parts_archetype_associations[plant_archetype].branches
|
||||
for i in n_branches:
|
||||
parts_to_place.append(pick_random(branches))
|
||||
|
||||
for m in plant_data.mutations:
|
||||
# print("mutations: ", m.id)
|
||||
var association: PartMutationAssociation = parts_mutation_associations[m.id]
|
||||
var mutation_possible_parts := association.parts
|
||||
for p in association.part_amount:
|
||||
parts_to_place.append(pick_random(mutation_possible_parts))
|
||||
|
||||
PlantData.State.GROWING:
|
||||
# print("Build growing texture")
|
||||
# var plant_archetype := plant_data.archetype
|
||||
if baby_bases.size() == 0:
|
||||
printerr("No baby base in archetype")
|
||||
return mature_texture
|
||||
# var base_part: PlantPart = pick_random(parts_archetype_associations[plant_archetype].baby_bases)
|
||||
texture = PLACEHOLDER_GROWING_TEXTURE
|
||||
base_part = pick_random(baby_bases)
|
||||
|
||||
var base_image := base_part.image
|
||||
var base_image_center: Vector2i = 0.5 * base_image.get_size()
|
||||
base_image_coord = image_center - Vector2i(base_part.root.position)
|
||||
image.blend_rect(base_image, Rect2i(Vector2i.ZERO, base_image.get_size()), base_image_coord - base_image_center)
|
||||
|
||||
for m in plant_data.mutations:
|
||||
# print("mutations: ", m.id)
|
||||
var association: PartMutationAssociation = parts_mutation_associations[m.id]
|
||||
var mutation_possible_parts := association.parts
|
||||
for p in ceil(0.5 * association.part_amount):
|
||||
parts_to_place.append(pick_random(mutation_possible_parts))
|
||||
_:
|
||||
print("Not handled state")
|
||||
return null
|
||||
|
||||
available_attaches = base_part.attaches.duplicate()
|
||||
parent_image_coords.resize(available_attaches.size())
|
||||
parent_image_coords.fill(base_image_coord)
|
||||
var weight_per_origin_type: Array[int] = origin_weights_base.values().duplicate()
|
||||
|
||||
for part: PlantPart in parts_to_place:
|
||||
# print("Add part : ", part.resource_name)
|
||||
var ind := find_random_matching_attach_ind(part.root, available_attaches)
|
||||
if ind == -1:
|
||||
printerr("No attach found")
|
||||
continue
|
||||
var parts_to_place: Dictionary[OriginType, Array] # BRANCH_ORIGIN : Array[PlantPart], MUTATION_ORIGIN : Array[Array[PlantPart]], BASE_LEAF_ORIGIN : Array[PlantPart]
|
||||
parts_to_place[OriginType.BRANCH_ORIGIN] = branches
|
||||
parts_to_place[OriginType.MUTATION_ORIGIN] = []
|
||||
parts_to_place[OriginType.BASE_LEAF_ORIGIN] = base_leaves
|
||||
var mutation_weights: Array[int] = []
|
||||
for mutation in plant_data.mutations:
|
||||
parts_to_place[OriginType.MUTATION_ORIGIN].append(parts_mutation_associations[mutation.id].parts)
|
||||
mutation_weights.append(mutation_weight_base)
|
||||
|
||||
var attach: PlantAttach = available_attaches.pop_at(ind)
|
||||
var base_image_coord = blend_part(image_center, Vector2.ZERO, base_part)
|
||||
populate_part(parts_to_place, weight_per_origin_type, mutation_weights, base_part, base_image_coord)
|
||||
|
||||
var parent_image_coord: Vector2i = parent_image_coords.pop_at(ind)
|
||||
|
||||
var part_image: Image = part.image
|
||||
var part_image_center: Vector2i = 0.5 * part_image.get_size()
|
||||
var part_image_coord: Vector2i = parent_image_coord + Vector2i(attach.position - part.root.position)
|
||||
image.blend_rect(part_image, Rect2i(Vector2i.ZERO, part.image.get_size()), part_image_coord - part_image_center)
|
||||
|
||||
for sub_attach in part.attaches:
|
||||
available_attaches.append(sub_attach)
|
||||
parent_image_coords.append(part_image_coord)
|
||||
|
||||
mature_texture = ImageTexture.create_from_image(image)
|
||||
texture = ImageTexture.create_from_image(image)
|
||||
image.fill(Color.TRANSPARENT)
|
||||
return mature_texture
|
||||
return texture
|
||||
|
||||
## returns -1 if not found
|
||||
func find_random_matching_attach_ind(attach_to_match: PlantAttach, array: Array[PlantAttach]) -> int:
|
||||
var indices: Array = range(array.size())
|
||||
func find_random_matching_attach_ind(attach_to_match: PlantAttach, array: Array[PlantPart]) -> int:
|
||||
var indices := range(array.size())
|
||||
shuffle(indices)
|
||||
for i in indices:
|
||||
if array[i].attach_types.any(func(type): return attach_to_match.attach_types.has(type)):
|
||||
if array[i].root.attach_types.any(func(type): return attach_to_match.attach_types.has(type)):
|
||||
return i
|
||||
return -1
|
||||
|
||||
func populate_part(all_parts: Dictionary[OriginType, Array], weight_per_origin_type: Array[int], mutation_weights: Array[int], parent_part: PlantPart, parent_image_coord: Vector2i):
|
||||
var part_placed: Array[PlantPart] # same ind as their corresponding attach
|
||||
var part_image_coords: Array[Vector2i] # idem
|
||||
|
||||
# first find and blend parts per attach
|
||||
for attach in parent_part.attaches:
|
||||
# get part to place
|
||||
var part_to_place := get_part(all_parts, weight_per_origin_type, mutation_weights, attach)
|
||||
part_placed.append(part_to_place)
|
||||
|
||||
# blend part
|
||||
if part_to_place:
|
||||
var part_image_coord := blend_part(parent_image_coord, attach.position, part_to_place)
|
||||
part_image_coords.append(part_image_coord)
|
||||
else:
|
||||
part_image_coords.append(Vector2i.ZERO)
|
||||
|
||||
# then populate them
|
||||
for i in range(part_placed.size()):
|
||||
if part_placed[i] != null:
|
||||
populate_part(all_parts, weight_per_origin_type, mutation_weights, part_placed[i], part_image_coords[i])
|
||||
|
||||
|
||||
func get_part(all_parts: Dictionary[OriginType, Array], weight_per_origin_type: Array[int], mutation_weights: Array[int], attach: PlantAttach) -> PlantPart:
|
||||
var rand := rng.randf()
|
||||
if rand <= chance_to_have_part:
|
||||
var origins: Array[int] = all_parts.keys().duplicate()
|
||||
var weight_copy: Array[int] = weight_per_origin_type.duplicate()
|
||||
shuffle_weighted(origins, weight_copy)
|
||||
for originIndInd: int in range(origins.size()):
|
||||
var originInd: int = origins[originIndInd]
|
||||
var origin := originInd as OriginType
|
||||
if origin == OriginType.BRANCH_ORIGIN || origin == OriginType.BASE_LEAF_ORIGIN:
|
||||
var ind := find_random_matching_attach_ind(attach, all_parts[origin])
|
||||
if ind >= 0:
|
||||
weight_per_origin_type[origin] -= origin_weight_loss
|
||||
weight_per_origin_type[((origin + 1) % 3) as OriginType] += origin_weight_gain
|
||||
weight_per_origin_type[((origin + 2) % 3) as OriginType] += origin_weight_gain
|
||||
return all_parts[origin][ind]
|
||||
else: # find a mutation part to place
|
||||
var parts_per_mutations: Array = all_parts[origin]
|
||||
shuffle_weighted(parts_per_mutations, mutation_weights)
|
||||
for mutation_parts_ind in range(parts_per_mutations.size()):
|
||||
var ind := find_random_matching_attach_ind(attach, parts_per_mutations[mutation_parts_ind])
|
||||
if ind >= 0:
|
||||
for i in range(mutation_weights.size()):
|
||||
mutation_weights[i] += mutation_weight_gain
|
||||
mutation_weights[mutation_parts_ind] -= mutation_weight_gain + mutation_weight_loss
|
||||
weight_per_origin_type[origin] -= origin_weight_loss
|
||||
weight_per_origin_type[(origin + 1) % 3] += origin_weight_gain
|
||||
weight_per_origin_type[(origin + 2) % 3] += origin_weight_gain
|
||||
return parts_per_mutations[mutation_parts_ind][ind]
|
||||
return null
|
||||
|
||||
func blend_part(parent_image_coord: Vector2i, attach_position: Vector2, part_to_blend: PlantPart) -> Vector2i:
|
||||
var part_image: Image = part_to_blend.image
|
||||
var part_image_center: Vector2i = 0.5 * part_image.get_size()
|
||||
var part_image_coord: Vector2i = parent_image_coord + Vector2i(attach_position - part_to_blend.root.position)
|
||||
image.blend_rect(part_image, Rect2i(Vector2i.ZERO, part_to_blend.image.get_size()), part_image_coord - part_image_center)
|
||||
return part_image_coord
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
[gd_scene format=4 uid="uid://cfsq3hma8djk3"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://daod4korkrm2r" path="res://entities/plants/scripts/texture_builder/part_assembler.gd" id="1_wqioj"]
|
||||
[ext_resource type="Texture2D" uid="uid://ctpo1togykb1v" path="res://stages/terrain/region/assets/textures/moss_biome/moss_contamination_atlas_texture_just_square.png" id="2_jldtq"]
|
||||
[ext_resource type="TileSet" uid="uid://bqo32vh5etspf" path="res://stages/terrain/region/resources/moss_biome.tres" id="3_3mb6h"]
|
||||
|
||||
[node name="TestSprites" type="Node2D" unique_id=1624731692]
|
||||
@@ -9,7 +8,7 @@ script = ExtResource("1_wqioj")
|
||||
n_plants_to_generate = 4
|
||||
n_plants_per_row = 5
|
||||
n_mutation_per_plant = 1
|
||||
space_between_plants = 100.0
|
||||
space_between_plants = 150.0
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="." unique_id=628954249]
|
||||
unique_name_in_owner = true
|
||||
@@ -105,15 +104,6 @@ title = "Possible Mutations"
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Camera2D/CanvasLayer/FoldableContainer/VBoxContainer/PossibleMutations" unique_id=611287858]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Icon" type="Sprite2D" parent="." unique_id=1007868132]
|
||||
visible = false
|
||||
texture_repeat = 2
|
||||
position = Vector2(495.5, 228.5)
|
||||
scale = Vector2(1.78625, 1.78625)
|
||||
texture = ExtResource("2_jldtq")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(0, 0, 2000, 2000)
|
||||
|
||||
[node name="Plants" type="Node" parent="." unique_id=849342032]
|
||||
unique_name_in_owner = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user