Add new tileset

This commit is contained in:
Ategon 2024-09-13 21:16:28 -04:00
parent 4cada48a71
commit ac3b0682be
7 changed files with 161 additions and 92 deletions

View file

@ -1,46 +1,12 @@
[gd_scene load_steps=14 format=3 uid="uid://5ske2hm55rce"]
[gd_scene load_steps=8 format=4 uid="uid://5ske2hm55rce"]
[ext_resource type="Theme" uid="uid://d035h7upxrw3h" path="res://theme.tres" id="1_xbn5h"]
[ext_resource type="Texture2D" uid="uid://bsrh0u02bckhy" path="res://iso_building.png" id="3_qa5pv"]
[ext_resource type="Texture2D" uid="uid://bvn5lewpp7pmd" path="res://iso_tile.png" id="4_7pks7"]
[ext_resource type="Texture2D" uid="uid://bdmao1k7ngu2m" path="res://basic_tiles.png" id="4_h72lx"]
[ext_resource type="TileSet" uid="uid://dhy53lakrlutm" path="res://TIleSet.tres" id="2_68wnv"]
[ext_resource type="PackedScene" uid="uid://dykc1mgg5uopw" path="res://components/Cursor/MouseHandler.tscn" id="5_6lpdu"]
[ext_resource type="Script" path="res://tile_map.gd" id="5_v47eg"]
[ext_resource type="PackedScene" uid="uid://byyyhq3x8t2d8" path="res://InfoWindow.tscn" id="7_f4xfy"]
[ext_resource type="PackedScene" uid="uid://b22pr3istdhcv" path="res://ui/BuildingMenu.tscn" id="7_hnxcf"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_dxrqb"]
texture = ExtResource("4_7pks7")
margins = Vector2i(16, 16)
1:1/0 = 0
0:0/0 = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_j7eew"]
texture = ExtResource("3_qa5pv")
margins = Vector2i(15, 14)
texture_region_size = Vector2i(18, 20)
1:1/0 = 0
0:0/0 = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_w6tof"]
texture = ExtResource("4_h72lx")
1:3/0 = 0
3:3/0 = 0
1:6/0 = 0
3:6/0 = 0
1:7/0 = 0
3:7/0 = 0
1:1/0 = 0
3:1/0 = 0
[sub_resource type="TileSet" id="TileSet_2mye8"]
tile_shape = 1
tile_layout = 5
tile_size = Vector2i(16, 8)
sources/0 = SubResource("TileSetAtlasSource_dxrqb")
sources/1 = SubResource("TileSetAtlasSource_j7eew")
sources/2 = SubResource("TileSetAtlasSource_w6tof")
[sub_resource type="RectangleShape2D" id="RectangleShape2D_57goo"]
size = Vector2(324, 314)
@ -53,10 +19,36 @@ offset_right = 40.0
offset_bottom = 40.0
theme = ExtResource("1_xbn5h")
[node name="A5" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAAiAAQAAwABAAMAAAAjAAQAAwABAAMAAAAkAAQAAwABAAMAAAAlAAQAAwABAAMAAAAmAAQAAwABAAMAAAAnAAQAAwABAAMAAAAnAAMAAwABAAMAAAAoAAMAAwABAAMAAAAoAAQAAwABAAMAAAAoAAIAAwABAAMAAAAoAAEAAwABAAMAAAAoAAAAAwABAAMAAAAoAP//AwABAAMAAAAoAP7/AwABAAMAAAAnAP7/AwABAAMAAAAmAP7/AwABAAMAAAAlAP7/AwABAAMAAAAkAP7/AwABAAMAAAAjAP7/AwABAAMAAAAiAP7/AwABAAMAAAAiAP//AwABAAMAAAAiAAAAAwABAAMAAAAiAAEAAwABAAMAAAAiAAIAAwABAAMAAAAjAAIAAwABAAMAAAAiAAMAAwABAAMAAAAjAAMAAwABAAMAAAAkAAIAAwABAAMAAAAlAAIAAwABAAMAAAAmAAIAAwABAAMAAAAmAAMAAwABAAMAAAAlAAMAAwABAAMAAAAkAAEAAwABAAMAAAAkAAAAAwABAAMAAAAkAP//AwABAAMAAAAlAAAAAwABAAMAAAAlAAEAAwABAAMAAAAmAAEAAwABAAMAAAAjAAAAAwABAAMAAAAjAP//AwABAAMAAAAlAP//AwABAAMAAAAmAP//AwABAAMAAAAmAAAAAwABAAMAAAAjAAEAAwABAAMAAAAnAP//AwABAAMAAAAnAAEAAwABAAMAAAAnAAAAAwABAAMAAAAnAAIAAwABAAMAAAAkAP3/AwABAAMAAAAkAAMAAwABAAMAAAAiAAUAAwABAAMAAAA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AAvAAUAAwABAAMAAAAvAAYAAwABAAMAAAAvAAcAAwABAAMAAAAvAAgAAwABAAMAAAAvAAkAAwABAAMAAAAvAAoAAwABAAMAAAAvAAsAAwABAAMAAAAiAAwAAwABAAMAAAAjAAwAAwABAAMAAAAkAAwAAwABAAMAAAAlAAwAAwABAAMAAAAmAAwAAwABAAMAAAAnAAwAAwABAAMAAAAoAAwAAwABAAMAAAApAAwAAwABAAMAAAAqAAwAAwABAAMAAAArAAwAAwABAAMAAAAsAAwAAwABAAMAAAAtAAwAAwABAAMAAAAuAAwAAwABAAMAAAAvAAwAAwABAAMAAAAwAP7/AwABAAMAAAAwAP//AwABAAMAAAAwAAAAAwABAAMAAAAwAAEAAwABAAMAAAAwAAIAAwABAAMAAAAwAAMAAwABAAMAAAAwAAQAAwABAAMAAAAwAAUAAwABAAMAAAAwAAYAAwABAAMAAAAwAAcAAwABAAMAAAAwAAgAAwABAAMAAAAwAAkAAwABAAMAAAAwAAoAAwABAAMAAAAwAAsAAwABAAMAAAAwAAwAAwABAAMAAAA=")
tile_set = ExtResource("2_68wnv")
[node name="A4" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAAgAP//AwADAAEAAAAhAP//AwADAAEAAAAiAP//AwADAAEAAAAjAP//AwADAAEAAAAjAP7/AwADAAEAAAAjAP3/AwADAAEAAAAjAPz/AwADAAEAAAAgAAAAAwADAAEAAAAhAAAAAwADAAEAAAAiAAAAAwADAAEAAAAjAAAAAwADAAEAAAAkAP//AwADAAEAAAAkAP7/AwADAAEAAAAkAP3/AwADAAEAAAAkAPz/AwADAAEAAAAiAPz/AwADAAEAAAAiAP3/AwADAAEAAAAiAP7/AwADAAEAAAAkAAAAAwADAAEAAAAhAAIAAwADAAEAAAAiAAIAAwADAAEAAAAjAAIAAwADAAEAAAAkAAIAAwADAAEAAAAkAAEAAwADAAEAAAAlAAEAAwADAAEAAAAlAAIAAwADAAEAAAAmAAIAAwADAAEAAAAmAAEAAwADAAEAAAAmAAAAAwADAAEAAAAmAP//AwADAAEAAAAmAP7/AwADAAEAAAAmAP3/AwADAAEAAAA=")
tile_set = ExtResource("2_68wnv")
[node name="A3" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAAgAP7/AwAFAAEAAAAhAP7/AwAFAAEAAAAiAP7/AwAFAAEAAAAiAP3/AwAFAAEAAAAiAPz/AwAFAAEAAAAgAPz/AwAFAAEAAAAgAP3/AwAFAAEAAAAhAP3/AwAFAAEAAAAhAPz/AwAFAAEAAAAgAP//AwAFAAEAAAAhAP//AwAFAAEAAAAiAP//AwAFAAEAAAAjAP//AwAFAAEAAAAjAP7/AwAFAAEAAAAjAP3/AwAFAAEAAAAjAPz/AwAFAAEAAAAkAPz/AwAFAAEAAAAkAP3/AwAFAAEAAAAkAP7/AwAFAAEAAAAkAP//AwAFAAEAAAAjAAAAAwAFAAEAAAAiAAAAAwAFAAEAAAAhAAAAAwAFAAEAAAAgAAAAAwAFAAEAAAAkAAAAAwAFAAEAAAA=")
tile_set = ExtResource("2_68wnv")
[node name="A2" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAAfAP3/AwAHAAEAAAAgAP3/AwAHAAEAAAAhAP3/AwAHAAEAAAAhAPz/AwAHAAEAAAAhAPv/AwAHAAEAAAAfAP7/AwAHAAEAAAAgAP7/AwAHAAEAAAAhAP7/AwAHAAEAAAAiAP7/AwAHAAEAAAAiAP3/AwAHAAEAAAAiAPz/AwAHAAEAAAAiAPv/AwAHAAEAAAAfAPz/AwAHAAEAAAAfAPv/AwAHAAEAAAAgAPv/AwAHAAEAAAAgAPz/AwAHAAEAAAA=")
tile_set = ExtResource("2_68wnv")
[node name="A" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAAfAPz/AwAJAAEAAAAgAPz/AwAJAAEAAAAgAPv/AwAJAAEAAAAgAPr/AwAJAAEAAAAeAPr/AwAJAAEAAAAeAPv/AwAJAAEAAAAfAPr/AwAJAAEAAAAeAPz/AwAJAAEAAAAfAPv/AwAJAAEAAAA=")
tile_set = ExtResource("2_68wnv")
[node name="TopLevel" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAAdAPn/AwALAAEAAAAdAPr/AwALAAEAAAAeAPr/AwALAAEAAAAeAPn/AwALAAEAAAA=")
tile_set = ExtResource("2_68wnv")
[node name="TileMap" type="TileMap" parent="."]
tile_set = SubResource("TileSet_2mye8")
visible = false
tile_set = ExtResource("2_68wnv")
rendering_quadrant_size = 128
format = 2
layer_0/tile_data = PackedInt32Array(65535, 327683, 1, 131071, 327683, 1, 0, 327683, 1, 65536, 327683, 1)
layer_1/name = "Layer1"
layer_2/name = "Layer2"
layer_3/name = "Layer3"
@ -71,10 +63,6 @@ position = Vector2(319, 177)
rotation = 0.750492
shape = SubResource("RectangleShape2D_57goo")
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(-48, -46)
offset = Vector2(50, 150)
[node name="CanvasLayer" type="CanvasLayer" parent="."]
[node name="InfoWindow" parent="CanvasLayer" instance=ExtResource("7_f4xfy")]

54
TIleSet.tres Normal file
View file

@ -0,0 +1,54 @@
[gd_resource type="TileSet" load_steps=9 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://bdmao1k7ngu2m" path="res://basic_tiles.png" id="3_rchy6"]
[ext_resource type="Texture2D" uid="uid://w1abxk1m0fae" path="res://tiles-v3.png" id="4_p6xw0"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_dxrqb"]
texture = ExtResource("1_sa4j6")
margins = Vector2i(16, 16)
1:1/0 = 0
0:0/0 = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_j7eew"]
texture = ExtResource("2_bubm3")
margins = Vector2i(15, 14)
texture_region_size = Vector2i(18, 20)
1:1/0 = 0
0:0/0 = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_w6tof"]
texture = ExtResource("3_rchy6")
1:3/0 = 0
3:3/0 = 0
1:6/0 = 0
3:6/0 = 0
1:7/0 = 0
3:7/0 = 0
1:1/0 = 0
3:1/0 = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_5o051"]
texture = ExtResource("4_p6xw0")
1:1/0 = 0
1:3/0 = 0
3:3/0 = 0
3:1/0 = 0
5:1/0 = 0
5:3/0 = 0
11:3/0 = 0
11:1/0 = 0
9:1/0 = 0
7:1/0 = 0
7:3/0 = 0
9:3/0 = 0
[resource]
tile_shape = 1
tile_layout = 5
tile_size = Vector2i(16, 8)
sources/0 = SubResource("TileSetAtlasSource_dxrqb")
sources/1 = SubResource("TileSetAtlasSource_j7eew")
sources/2 = SubResource("TileSetAtlasSource_w6tof")
sources/3 = SubResource("TileSetAtlasSource_5o051")

View file

@ -31,50 +31,50 @@ func _ready():
Triggerer.listen("select_building", select_building)
Triggerer.listen("drag_building", drag_building)
for x in GridSize:
for y in GridSize:
var layer_number: int
var x_value: int = abs(GridSize/2 - x)
var y_value: int = abs(GridSize/2 - y)
var max_value: int = maxi(x_value, y_value)
match max_value:
16,15:
layer_number = 1
14:
layer_number = generate_percentage([3,1])
13:
layer_number = generate_percentage([2,1])
12:
layer_number = generate_percentage([1,1])
11:
layer_number = generate_percentage([1,2,1])
10:
layer_number = generate_percentage([0,3,2])
9:
layer_number = generate_percentage([0,1,1])
8:
layer_number = generate_percentage([0,1,2,1])
7:
layer_number = generate_percentage([0,0,3,2])
6:
layer_number = generate_percentage([0,0,1,1])
5:
layer_number = generate_percentage([0,0,1,2,1])
4:
layer_number = generate_percentage([0,0,0,3,2])
3:
layer_number = generate_percentage([0,0,0,1,1])
2:
layer_number = generate_percentage([0,0,0,1,2])
1,0:
layer_number = 5
print("x- ",x," y- ",y," layer- ",layer_number)
for layer in layer_number:
set_cell(layer, Vector2(x, y), 2, Vector2i(1, 1), 0)
Dic[str(Vector2(x,y))] = {
"Layer": layer_number,
"Placed": false
}
#for x in GridSize:
#for y in GridSize:
#var layer_number: int
#var x_value: int = abs(GridSize/2 - x)
#var y_value: int = abs(GridSize/2 - y)
#var max_value: int = maxi(x_value, y_value)
#match max_value:
#16,15:
#layer_number = 1
#14:
#layer_number = generate_percentage([3,1])
#13:
#layer_number = generate_percentage([2,1])
#12:
#layer_number = generate_percentage([1,1])
#11:
#layer_number = generate_percentage([1,2,1])
#10:
#layer_number = generate_percentage([0,3,2])
#9:
#layer_number = generate_percentage([0,1,1])
#8:
#layer_number = generate_percentage([0,1,2,1])
#7:
#layer_number = generate_percentage([0,0,3,2])
#6:
#layer_number = generate_percentage([0,0,1,1])
#5:
#layer_number = generate_percentage([0,0,1,2,1])
#4:
#layer_number = generate_percentage([0,0,0,3,2])
#3:
#layer_number = generate_percentage([0,0,0,1,1])
#2:
#layer_number = generate_percentage([0,0,0,1,2])
#1,0:
#layer_number = 5
#print("x- ",x," y- ",y," layer- ",layer_number)
#for layer in layer_number:
#set_cell(layer, Vector2(x, y), 2, Vector2i(1, 1), 0)
#Dic[str(Vector2(x,y))] = {
#"Layer": layer_number,
#"Placed": false
#}
func _process(delta):
if Input.is_action_just_released("lclick"):

BIN
tiles-v3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

34
tiles-v3.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://w1abxk1m0fae"
path="res://.godot/imported/tiles-v3.png-c6fefb34fcf2e018f876a1e8a690296d.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://tiles-v3.png"
dest_files=["res://.godot/imported/tiles-v3.png-c6fefb34fcf2e018f876a1e8a690296d.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

View file

@ -16,17 +16,12 @@ func _on_mouse_handler_hovered() -> void:
func _on_mouse_handler_unhovered() -> void:
print(key)
print("DRAG 1")
if clicked:
print("DRAG")
Triggerer.trigger("drag_building", { "key": key })
clicked = false
func _on_mouse_handler_released() -> void:
print("SELECT 1")
if clicked:
print("SELECT")
Triggerer.trigger("select_building", { "key": key })
clicked = false

View file

@ -51,8 +51,6 @@ func swap_to_tab(index):
if i > 0:
spacers[i - 1].visible = false
print(icons.map(func(icon): return icon.key))
func _on_building_tab_clicked() -> void:
swap_to_tab(0)