Add tilemap UI
This commit is contained in:
parent
098a43c452
commit
9fc1776517
7 changed files with 86 additions and 5 deletions
33
Main.tscn
33
Main.tscn
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=18 format=4 uid="uid://5ske2hm55rce"]
|
||||
[gd_scene load_steps=19 format=4 uid="uid://5ske2hm55rce"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://n2lpy72tkyc8" path="res://storm/StormManager.tscn" id="1_gcxt1"]
|
||||
[ext_resource type="Script" path="res://main.gd" id="1_pg2kh"]
|
||||
|
@ -12,6 +12,7 @@
|
|||
[ext_resource type="Texture2D" uid="uid://bccyjf2bn3mpj" path="res://background.png" id="7_bnuu0"]
|
||||
[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"]
|
||||
[ext_resource type="Script" path="res://ui_level.gd" id="9_8qp2o"]
|
||||
[ext_resource type="PackedScene" path="res://Night.tscn" id="13_8fvl0"]
|
||||
[ext_resource type="AudioStream" uid="uid://dfxndvkdey800" path="res://light version final(1).wav" id="13_tvksj"]
|
||||
[ext_resource type="AudioStream" uid="uid://dk2thkxy31doi" path="res://heavy version.wav" id="14_frsfx"]
|
||||
|
@ -92,11 +93,15 @@ tile_set = ExtResource("2_68wnv")
|
|||
|
||||
[node name="BuildingLevel2" type="TileMapLayer" parent="Node2D/Level2"]
|
||||
y_sort_enabled = true
|
||||
tile_map_data = PackedByteArray("AAAlAP3/AQABAAEAAAAmAPz/AQABAAEAAAAmAP3/AQABAAEAAAAmAAAAAQABAAEAAAA=")
|
||||
tile_set = ExtResource("2_68wnv")
|
||||
script = ExtResource("5_3vufn")
|
||||
building_spots = Array[Vector2i]([Vector2i(33, 5), Vector2i(33, 4), Vector2i(33, 3), Vector2i(34, 4), Vector2i(34, 3), Vector2i(34, 2), Vector2i(34, 1), Vector2i(35, 3), Vector2i(35, 2), Vector2i(36, 3), Vector2i(36, 2), Vector2i(37, 3), Vector2i(38, 4), Vector2i(38, 3), Vector2i(39, 4), Vector2i(39, 3), Vector2i(39, 5), Vector2i(40, 5), Vector2i(40, 4), Vector2i(40, 3), Vector2i(40, 2), Vector2i(40, 1), Vector2i(41, 4), Vector2i(41, 3), Vector2i(41, 2), Vector2i(41, 1), Vector2i(41, 0), Vector2i(42, 4), Vector2i(42, 3), Vector2i(42, 2), Vector2i(42, 1), Vector2i(43, 2), Vector2i(43, 3), Vector2i(44, 3), Vector2i(41, -4), Vector2i(41, -5), Vector2i(42, -3), Vector2i(42, -4), Vector2i(42, -5), Vector2i(43, -5)])
|
||||
|
||||
[node name="UILevel2" type="TileMapLayer" parent="Node2D/Level2"]
|
||||
y_sort_enabled = true
|
||||
tile_set = ExtResource("2_68wnv")
|
||||
script = ExtResource("9_8qp2o")
|
||||
|
||||
[node name="WaterLevel2" type="TileMapLayer" parent="Node2D/Level2"]
|
||||
visible = false
|
||||
y_sort_enabled = true
|
||||
|
@ -116,6 +121,11 @@ tile_set = ExtResource("2_68wnv")
|
|||
script = ExtResource("5_3vufn")
|
||||
building_spots = Array[Vector2i]([Vector2i(37, 1), Vector2i(37, 0), Vector2i(38, 1), Vector2i(38, 0), Vector2i(36, -3), Vector2i(36, -4), Vector2i(37, -2), Vector2i(37, -3), Vector2i(37, -4), Vector2i(38, -1), Vector2i(38, -2), Vector2i(38, -3), Vector2i(38, -4), Vector2i(38, -5), Vector2i(39, -2), Vector2i(39, -1), Vector2i(39, -3), Vector2i(39, -4), Vector2i(39, -5), Vector2i(39, -6), Vector2i(40, -3), Vector2i(40, -4)])
|
||||
|
||||
[node name="UILevel3" type="TileMapLayer" parent="Node2D/Level3"]
|
||||
y_sort_enabled = true
|
||||
tile_set = ExtResource("2_68wnv")
|
||||
script = ExtResource("9_8qp2o")
|
||||
|
||||
[node name="WaterLevel3" type="TileMapLayer" parent="Node2D/Level3"]
|
||||
visible = false
|
||||
y_sort_enabled = true
|
||||
|
@ -135,6 +145,11 @@ tile_set = ExtResource("2_68wnv")
|
|||
script = ExtResource("5_3vufn")
|
||||
building_spots = Array[Vector2i]([Vector2i(31, -3), Vector2i(31, -2), Vector2i(31, -1), Vector2i(31, 0), Vector2i(32, -2), Vector2i(32, -3), Vector2i(32, -4), Vector2i(33, -3), Vector2i(33, -4), Vector2i(33, -5), Vector2i(33, -2), Vector2i(33, -1), Vector2i(34, -2), Vector2i(34, -3), Vector2i(34, -1), Vector2i(34, -4), Vector2i(34, -5), Vector2i(35, -6), Vector2i(35, -3), Vector2i(35, -2), Vector2i(35, -1), Vector2i(35, 0), Vector2i(36, -2), Vector2i(36, -6), Vector2i(36, -7), Vector2i(37, -7)])
|
||||
|
||||
[node name="UILevel4" type="TileMapLayer" parent="Node2D/Level4"]
|
||||
y_sort_enabled = true
|
||||
tile_set = ExtResource("2_68wnv")
|
||||
script = ExtResource("9_8qp2o")
|
||||
|
||||
[node name="WaterLevel4" type="TileMapLayer" parent="Node2D/Level4"]
|
||||
visible = false
|
||||
y_sort_enabled = true
|
||||
|
@ -154,6 +169,11 @@ 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)])
|
||||
|
||||
[node name="UILevel5" type="TileMapLayer" parent="Node2D/Level5"]
|
||||
y_sort_enabled = true
|
||||
tile_set = ExtResource("2_68wnv")
|
||||
script = ExtResource("9_8qp2o")
|
||||
|
||||
[node name="WaterLevel5" type="TileMapLayer" parent="Node2D/Level5"]
|
||||
visible = false
|
||||
y_sort_enabled = true
|
||||
|
@ -162,12 +182,19 @@ tile_set = ExtResource("2_68wnv")
|
|||
script = ExtResource("4_vc41k")
|
||||
level = 5
|
||||
|
||||
[node name="BuildingLevel6" type="TileMapLayer" parent="Node2D"]
|
||||
[node name="Node2D" type="Node2D" parent="Node2D"]
|
||||
|
||||
[node name="BuildingLevel6" type="TileMapLayer" parent="Node2D/Node2D"]
|
||||
y_sort_enabled = true
|
||||
tile_set = ExtResource("2_68wnv")
|
||||
script = ExtResource("5_3vufn")
|
||||
building_spots = Array[Vector2i]([Vector2i(29, -8), Vector2i(29, -9), Vector2i(30, -9)])
|
||||
|
||||
[node name="UILevel6" type="TileMapLayer" parent="Node2D/Node2D"]
|
||||
y_sort_enabled = true
|
||||
tile_set = ExtResource("2_68wnv")
|
||||
script = ExtResource("9_8qp2o")
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="UI" parent="CanvasLayer" instance=ExtResource("1_ve2mn")]
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
[gd_resource type="TileSet" load_steps=9 format=3 uid="uid://dhy53lakrlutm"]
|
||||
[gd_resource type="TileSet" load_steps=11 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"]
|
||||
[ext_resource type="Texture2D" uid="uid://cjfpd778ggjer" path="res://select.png" id="5_s3lj1"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_dxrqb"]
|
||||
texture = ExtResource("1_sa4j6")
|
||||
|
@ -65,6 +66,11 @@ texture = ExtResource("4_p6xw0")
|
|||
9:3/0/texture_origin = Vector2i(0, 4)
|
||||
9:3/0/y_sort_origin = 3
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_sneuq"]
|
||||
texture = ExtResource("5_s3lj1")
|
||||
0:0/0 = 0
|
||||
0:0/0/texture_origin = Vector2i(0, 4)
|
||||
|
||||
[resource]
|
||||
tile_shape = 1
|
||||
tile_layout = 5
|
||||
|
@ -73,3 +79,4 @@ sources/0 = SubResource("TileSetAtlasSource_dxrqb")
|
|||
sources/1 = SubResource("TileSetAtlasSource_j7eew")
|
||||
sources/2 = SubResource("TileSetAtlasSource_w6tof")
|
||||
sources/3 = SubResource("TileSetAtlasSource_5o051")
|
||||
sources/4 = SubResource("TileSetAtlasSource_sneuq")
|
||||
|
|
2
main.gd
2
main.gd
|
@ -5,7 +5,7 @@ extends Node2D
|
|||
$Node2D/Level3/BuildingLevel3,
|
||||
$Node2D/Level4/BuildingLevel4,
|
||||
$Node2D/Level5/BuildingLevel5,
|
||||
$Node2D/BuildingLevel6
|
||||
$Node2D/Node2D/BuildingLevel6
|
||||
]
|
||||
@onready var night: ColorRect = $CanvasLayer/Night
|
||||
var night_tween
|
||||
|
|
BIN
select.aseprite
Normal file
BIN
select.aseprite
Normal file
Binary file not shown.
BIN
select.png
Normal file
BIN
select.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 130 B |
34
select.png.import
Normal file
34
select.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cjfpd778ggjer"
|
||||
path="res://.godot/imported/select.png-3801f3cc86fbf2d4a07926d2b7ddb766.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://select.png"
|
||||
dest_files=["res://.godot/imported/select.png-3801f3cc86fbf2d4a07926d2b7ddb766.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
|
13
ui_level.gd
Normal file
13
ui_level.gd
Normal file
|
@ -0,0 +1,13 @@
|
|||
extends TileMapLayer
|
||||
|
||||
@onready var building_level = get_parent().get_child(0)
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var tile = local_to_map(get_global_mouse_position())
|
||||
var building_mode = Persister.get_value("building_mode")
|
||||
|
||||
for spot in building_level.building_spots:
|
||||
erase_cell(spot)
|
||||
|
||||
if not building_mode and building_level.building_spots.has(tile):
|
||||
set_cell(tile, 4, Vector2i(0, 0), 0)
|
Loading…
Reference in a new issue