Add town hall
|
@ -3,6 +3,7 @@ extends TileMapLayer
|
|||
@export var building_spots: Array[Vector2i]
|
||||
@export var tree_spots: Array[Vector2i]
|
||||
@export var rock_spots: Array[Vector2i]
|
||||
@export var th_spots: Array[Vector2i]
|
||||
|
||||
var building_data = {}
|
||||
var last_tile
|
||||
|
@ -59,7 +60,7 @@ func _process(delta: float) -> void:
|
|||
var building_mode = Persister.get_value("building_mode")
|
||||
|
||||
for spot in building_spots:
|
||||
if not building_data.has(spot) and not tree_spots.has(spot) and not rock_spots.has(spot):
|
||||
if not building_data.has(spot) and not tree_spots.has(spot) and not rock_spots.has(spot) and not th_spots.has(spot):
|
||||
erase_cell(spot)
|
||||
|
||||
if last_tile != tile:
|
||||
|
@ -79,6 +80,11 @@ func _process(delta: float) -> void:
|
|||
last_text.text = "[center]Tree"
|
||||
last_text.position = map_to_local(tile) + Vector2(-25, -10)
|
||||
add_sibling(last_text)
|
||||
elif th_spots.has(tile):
|
||||
last_text = NAME_ICON.instantiate()
|
||||
last_text.text = "[center]Town Hall"
|
||||
last_text.position = map_to_local(tile) + Vector2(-25, -10)
|
||||
add_sibling(last_text)
|
||||
elif building_data.has(tile):
|
||||
last_text = NAME_ICON.instantiate()
|
||||
last_text.text = "[center]%s" % [Data.data.buildings[building_data[tile].key].name]
|
||||
|
@ -90,7 +96,7 @@ func _process(delta: float) -> void:
|
|||
if not building_mode:
|
||||
return
|
||||
|
||||
if building_spots.has(tile) and not rock_spots.has(tile) and not tree_spots.has(tile):
|
||||
if building_spots.has(tile) and not rock_spots.has(tile) and not tree_spots.has(tile) and not th_spots.has(tile):
|
||||
var build_data = building_to_tile_map[Persister.get_value("building_key")]
|
||||
set_cell(tile, build_data["source"], Vector2i(build_data["atlas"],rand), 0)
|
||||
|
||||
|
@ -99,7 +105,7 @@ func _process(delta: float) -> void:
|
|||
|
||||
func place_building():
|
||||
var tile = local_to_map(get_global_mouse_position())
|
||||
if building_spots.has(tile) and not building_data.has(tile) and not tree_spots.has(tile) and not rock_spots.has(tile):
|
||||
if building_spots.has(tile) and not building_data.has(tile) and not tree_spots.has(tile) and not rock_spots.has(tile) and not th_spots.has(tile):
|
||||
Persister.persist_data("building_mode", false)
|
||||
building_data[tile] = {
|
||||
"key": Persister.get_value("building_key"),
|
||||
|
@ -116,7 +122,6 @@ func place_building():
|
|||
if build_data.type == "housing":
|
||||
Persister.change_value("max_population", int(build_data.amount))
|
||||
building_data[tile].max_population = int(build_data.amount)
|
||||
building_data[tile].population = 0 # TODO: handle overflowing pop?
|
||||
|
||||
Persister.persist_data("drag_mode", false)
|
||||
|
||||
|
|
25
Main.tscn
|
@ -373,16 +373,16 @@ level = 4
|
|||
|
||||
[node name="Level5" type="TileMapLayer" parent="Node2D"]
|
||||
y_sort_enabled = true
|
||||
tile_map_data = PackedByteArray("AAAeAPj/AwALAAEAAAAeAPn/AwALAAEAAAAfAPj/AwALAAEAAAA=")
|
||||
tile_map_data = PackedByteArray("AAAeAPj/AwALAAEAAAAeAPn/AwALAAEAAAAfAPj/AwALAAEAAAAfAPn/AwALAAEAAAA=")
|
||||
tile_set = ExtResource("2_68wnv")
|
||||
|
||||
[node name="BuildingLevel5" type="TileMapLayer" parent="Node2D/Level5"]
|
||||
y_sort_enabled = true
|
||||
tile_map_data = PackedByteArray("AAAgAPj/BQAEAAAAAAAfAPn/BQAEAAEAAAA=")
|
||||
tile_map_data = PackedByteArray("AAAgAPj/BQAEAAAAAAAfAPr/BQAEAAEAAAA=")
|
||||
tile_set = ExtResource("2_68wnv")
|
||||
script = ExtResource("5_3vufn")
|
||||
building_spots = Array[Vector2i]([Vector2i(30, -6), Vector2i(30, -5), Vector2i(31, -6), Vector2i(31, -7), Vector2i(32, -7), Vector2i(32, -8), Vector2i(33, -7), Vector2i(33, -8), Vector2i(34, -8)])
|
||||
rock_spots = Array[Vector2i]([Vector2i(31, -7), Vector2i(32, -8)])
|
||||
rock_spots = Array[Vector2i]([Vector2i(31, -6), Vector2i(32, -8)])
|
||||
|
||||
[node name="UILevel5" type="TileMapLayer" parent="Node2D/Level5"]
|
||||
y_sort_enabled = true
|
||||
|
@ -401,9 +401,11 @@ level = 5
|
|||
|
||||
[node name="BuildingLevel6" type="TileMapLayer" parent="Node2D/Node2D"]
|
||||
y_sort_enabled = true
|
||||
tile_map_data = PackedByteArray("AAAeAPn/DQAAAAEAAAAfAPj/DQABAAEAAAAdAPb/DQABAAAAAAAcAPf/DQAAAAAAAAA=")
|
||||
tile_set = ExtResource("2_68wnv")
|
||||
script = ExtResource("5_3vufn")
|
||||
building_spots = Array[Vector2i]([Vector2i(29, -8), Vector2i(29, -9), Vector2i(30, -9)])
|
||||
building_spots = Array[Vector2i]([Vector2i(29, -8), Vector2i(29, -9), Vector2i(30, -9), Vector2i(30, -8)])
|
||||
th_spots = Array[Vector2i]([Vector2i(29, -8), Vector2i(29, -9), Vector2i(30, -9), Vector2i(30, -8)])
|
||||
|
||||
[node name="UILevel6" type="TileMapLayer" parent="Node2D/Node2D"]
|
||||
y_sort_enabled = true
|
||||
|
@ -465,8 +467,9 @@ key = "essence"
|
|||
|
||||
[node name="Control" type="Control" parent="CanvasLayer/UI/Background"]
|
||||
anchors_preset = 0
|
||||
offset_top = -28.0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
offset_bottom = 12.0
|
||||
|
||||
[node name="WoodIcon" type="TextureRect" parent="CanvasLayer/UI/Background/Control"]
|
||||
layout_mode = 0
|
||||
|
@ -483,7 +486,7 @@ offset_left = 65.0
|
|||
offset_top = -2.29
|
||||
offset_right = 124.0
|
||||
offset_bottom = 21.71
|
||||
theme_override_colors/font_color = Color(0.534989, 0.260301, 0.265325, 1)
|
||||
theme_override_colors/font_color = Color(0.663356, 0.340515, 0.345081, 1)
|
||||
theme_override_constants/outline_size = 3
|
||||
text = "0
|
||||
"
|
||||
|
@ -494,8 +497,9 @@ key = "wood"
|
|||
[node name="Control3" type="Control" parent="CanvasLayer/UI/Background"]
|
||||
anchors_preset = 0
|
||||
offset_left = 41.0
|
||||
offset_top = -28.0
|
||||
offset_right = 81.0
|
||||
offset_bottom = 40.0
|
||||
offset_bottom = 12.0
|
||||
|
||||
[node name="WoodIcon" type="TextureRect" parent="CanvasLayer/UI/Background/Control3"]
|
||||
layout_mode = 0
|
||||
|
@ -512,7 +516,7 @@ offset_left = 65.0
|
|||
offset_top = -2.29
|
||||
offset_right = 124.0
|
||||
offset_bottom = 21.71
|
||||
theme_override_colors/font_color = Color(0.301864, 0.365251, 0.444553, 1)
|
||||
theme_override_colors/font_color = Color(0.403492, 0.47752, 0.570235, 1)
|
||||
theme_override_constants/outline_size = 3
|
||||
text = "0/0
|
||||
"
|
||||
|
@ -521,8 +525,9 @@ script = ExtResource("16_knn3d")
|
|||
|
||||
[node name="Control2" type="Control" parent="CanvasLayer/UI/Background"]
|
||||
anchors_preset = 0
|
||||
offset_top = -28.0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
offset_bottom = 12.0
|
||||
|
||||
[node name="StoneIcon" type="TextureRect" parent="CanvasLayer/UI/Background/Control2"]
|
||||
layout_mode = 0
|
||||
|
@ -539,7 +544,7 @@ offset_left = 23.0
|
|||
offset_top = -2.29
|
||||
offset_right = 61.0
|
||||
offset_bottom = 21.71
|
||||
theme_override_colors/font_color = Color(0.258486, 0.352181, 0.402271, 1)
|
||||
theme_override_colors/font_color = Color(0.335321, 0.446052, 0.505412, 1)
|
||||
theme_override_constants/outline_size = 3
|
||||
text = "0"
|
||||
vertical_alignment = 1
|
||||
|
|
30
TIleSet.tres
|
@ -1,11 +1,15 @@
|
|||
[gd_resource type="TileSet" load_steps=21 format=3 uid="uid://dhy53lakrlutm"]
|
||||
[gd_resource type="TileSet" load_steps=29 format=3 uid="uid://dhy53lakrlutm"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bvn5lewpp7pmd" path="res://iso_tile.png" id="1_sa4j6"]
|
||||
[ext_resource type="Texture2D" uid="uid://bsrh0u02bckhy" path="res://iso_building.png" id="2_bubm3"]
|
||||
[ext_resource type="Texture2D" uid="uid://dbbhhs5aiuejw" path="res://tiles_ruined_collectors.png" id="3_7x1fh"]
|
||||
[ext_resource type="Texture2D" uid="uid://bdmao1k7ngu2m" path="res://basic_tiles.png" id="3_rchy6"]
|
||||
[ext_resource type="Texture2D" uid="uid://fa4m6cupo65w" path="res://tiles_ruined_foodwater.png" id="4_axgg8"]
|
||||
[ext_resource type="Texture2D" uid="uid://w1abxk1m0fae" path="res://tiles-v3.png" id="4_p6xw0"]
|
||||
[ext_resource type="Texture2D" uid="uid://cps3axbh7qgc0" path="res://tiles_ruined_houses.png" id="5_16ny2"]
|
||||
[ext_resource type="Texture2D" uid="uid://cjfpd778ggjer" path="res://select.png" id="5_s3lj1"]
|
||||
[ext_resource type="Texture2D" uid="uid://cvn1fg4v6kur3" path="res://tilerocks.png" id="6_f8tld"]
|
||||
[ext_resource type="Texture2D" uid="uid://8sb6dyux6i44" path="res://townhall.png" id="6_q784e"]
|
||||
[ext_resource type="Texture2D" uid="uid://c43udkovhiiv8" path="res://tiletrees.png" id="7_grd50"]
|
||||
[ext_resource type="Texture2D" uid="uid://bmxo8xwxghc1k" path="res://tiles_foodwater.png" id="8_tscyy"]
|
||||
[ext_resource type="Texture2D" uid="uid://cgpbrsl2nlhlr" path="res://tiles_houses.png" id="9_dx80t"]
|
||||
|
@ -21,6 +25,26 @@ margins = Vector2i(16, 16)
|
|||
texture = ExtResource("2_bubm3")
|
||||
1:1/0 = 0
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_83p42"]
|
||||
texture = ExtResource("3_7x1fh")
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_mrgl4"]
|
||||
texture = ExtResource("4_axgg8")
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_w6ttr"]
|
||||
texture = ExtResource("5_16ny2")
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_jhyw0"]
|
||||
texture = ExtResource("6_q784e")
|
||||
0:0/0 = 0
|
||||
0:0/0/texture_origin = Vector2i(0, 4)
|
||||
0:1/0 = 0
|
||||
0:1/0/texture_origin = Vector2i(0, 4)
|
||||
1:1/0 = 0
|
||||
1:1/0/texture_origin = Vector2i(0, 4)
|
||||
1:0/0 = 0
|
||||
1:0/0/texture_origin = Vector2i(0, 4)
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_w6tof"]
|
||||
texture = ExtResource("3_rchy6")
|
||||
1:3/0 = 0
|
||||
|
@ -177,3 +201,7 @@ sources/6 = SubResource("TileSetAtlasSource_ffqbc")
|
|||
sources/7 = SubResource("TileSetAtlasSource_w46yf")
|
||||
sources/8 = SubResource("TileSetAtlasSource_7cbry")
|
||||
sources/9 = SubResource("TileSetAtlasSource_0vrje")
|
||||
sources/10 = SubResource("TileSetAtlasSource_83p42")
|
||||
sources/11 = SubResource("TileSetAtlasSource_mrgl4")
|
||||
sources/12 = SubResource("TileSetAtlasSource_w6ttr")
|
||||
sources/13 = SubResource("TileSetAtlasSource_jhyw0")
|
||||
|
|
BIN
population.png
Before Width: | Height: | Size: 201 B After Width: | Height: | Size: 214 B |
BIN
stone.png
Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 297 B |
BIN
tiles_ruined_collectors.png
Normal file
After Width: | Height: | Size: 780 B |
34
tiles_ruined_collectors.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dbbhhs5aiuejw"
|
||||
path="res://.godot/imported/tiles_ruined_collectors.png-a5e77afa89fc15eab3b18afd6bbc708c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://tiles_ruined_collectors.png"
|
||||
dest_files=["res://.godot/imported/tiles_ruined_collectors.png-a5e77afa89fc15eab3b18afd6bbc708c.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
tiles_ruined_foodwater.png
Normal file
After Width: | Height: | Size: 974 B |
34
tiles_ruined_foodwater.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://fa4m6cupo65w"
|
||||
path="res://.godot/imported/tiles_ruined_foodwater.png-c682a3972dd3815af0ced96506d13f49.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://tiles_ruined_foodwater.png"
|
||||
dest_files=["res://.godot/imported/tiles_ruined_foodwater.png-c682a3972dd3815af0ced96506d13f49.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
tiles_ruined_houses.png
Normal file
After Width: | Height: | Size: 662 B |
34
tiles_ruined_houses.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cps3axbh7qgc0"
|
||||
path="res://.godot/imported/tiles_ruined_houses.png-11ac51b49ecd60169c9343b644bb8b82.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://tiles_ruined_houses.png"
|
||||
dest_files=["res://.godot/imported/tiles_ruined_houses.png-11ac51b49ecd60169c9343b644bb8b82.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
townhall.png
Normal file
After Width: | Height: | Size: 544 B |
34
townhall.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://8sb6dyux6i44"
|
||||
path="res://.godot/imported/townhall.png-428e00a1e64f755d4482bd6b384f9e2a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://townhall.png"
|
||||
dest_files=["res://.godot/imported/townhall.png-428e00a1e64f755d4482bd6b384f9e2a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
BIN
wood.png
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 342 B |