Fix building
This commit is contained in:
parent
d2a51dd9b3
commit
c7140911a7
7 changed files with 103 additions and 32 deletions
45
BuildingLevel.gd
Normal file
45
BuildingLevel.gd
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
extends TileMapLayer
|
||||||
|
|
||||||
|
@export var building_spots: Array[Vector2i]
|
||||||
|
|
||||||
|
var building_data = {}
|
||||||
|
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
var tile = local_to_map(get_global_mouse_position())
|
||||||
|
var building_mode = Persister.get_value("building_mode")
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("lclick"):
|
||||||
|
if building_mode:
|
||||||
|
place_building()
|
||||||
|
else:
|
||||||
|
show_info_building()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for spot in building_spots:
|
||||||
|
if not building_data.has(spot):
|
||||||
|
erase_cell(spot)
|
||||||
|
|
||||||
|
if not building_mode:
|
||||||
|
return
|
||||||
|
|
||||||
|
if building_spots.has(tile):
|
||||||
|
set_cell(tile, 1, Vector2i(0,0), 0)
|
||||||
|
|
||||||
|
|
||||||
|
func place_building():
|
||||||
|
var tile = local_to_map(get_global_mouse_position())
|
||||||
|
if building_spots.has(tile):
|
||||||
|
Persister.persist_data("building_mode", false)
|
||||||
|
building_data[tile] = {
|
||||||
|
"key": Persister.get_value("building_key"),
|
||||||
|
}
|
||||||
|
|
||||||
|
Persister.persist_data("drag_mode", false)
|
||||||
|
|
||||||
|
|
||||||
|
func show_info_building():
|
||||||
|
var tile = local_to_map(get_global_mouse_position())
|
||||||
|
if building_data.has(tile):
|
||||||
|
Triggerer.trigger("show_info", building_data[tile])
|
60
Main.tscn
60
Main.tscn
|
@ -1,19 +1,17 @@
|
||||||
[gd_scene load_steps=11 format=4 uid="uid://5ske2hm55rce"]
|
[gd_scene load_steps=10 format=4 uid="uid://5ske2hm55rce"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://n2lpy72tkyc8" path="res://storm/StormManager.tscn" id="1_gcxt1"]
|
[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"]
|
||||||
[ext_resource type="PackedScene" uid="uid://bxctpr0tfqidf" path="res://ui/UI.tscn" id="1_ve2mn"]
|
[ext_resource type="PackedScene" uid="uid://bxctpr0tfqidf" path="res://ui/UI.tscn" id="1_ve2mn"]
|
||||||
[ext_resource type="Theme" uid="uid://d035h7upxrw3h" path="res://theme.tres" id="1_xbn5h"]
|
[ext_resource type="Theme" uid="uid://d035h7upxrw3h" path="res://theme.tres" id="1_xbn5h"]
|
||||||
[ext_resource type="TileSet" uid="uid://dhy53lakrlutm" path="res://TIleSet.tres" id="2_68wnv"]
|
[ext_resource type="TileSet" uid="uid://dhy53lakrlutm" path="res://TIleSet.tres" id="2_68wnv"]
|
||||||
[ext_resource type="Script" path="res://water_level.gd" id="4_vc41k"]
|
[ext_resource type="Script" path="res://water_level.gd" id="4_vc41k"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dykc1mgg5uopw" path="res://components/Cursor/MouseHandler.tscn" id="5_6lpdu"]
|
[ext_resource type="Script" path="res://BuildingLevel.gd" id="5_3vufn"]
|
||||||
[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://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="PackedScene" uid="uid://b22pr3istdhcv" path="res://ui/BuildingMenu.tscn" id="7_hnxcf"]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_57goo"]
|
|
||||||
size = Vector2(324, 314)
|
|
||||||
|
|
||||||
[node name="Main" type="Node2D"]
|
[node name="Main" type="Node2D"]
|
||||||
|
script = ExtResource("1_pg2kh")
|
||||||
|
|
||||||
[node name="StormManager" parent="." instance=ExtResource("1_gcxt1")]
|
[node name="StormManager" parent="." instance=ExtResource("1_gcxt1")]
|
||||||
|
|
||||||
|
@ -47,6 +45,12 @@ y_sort_enabled = true
|
||||||
tile_map_data = PackedByteArray("AAAhAP7/AwAFAAEAAAAiAP7/AwAFAAEAAAAiAP3/AwAFAAEAAAAiAPz/AwAFAAEAAAAhAP3/AwAFAAEAAAAhAPz/AwAFAAEAAAAhAP//AwAFAAEAAAAiAP//AwAFAAEAAAAjAP//AwAFAAEAAAAjAP7/AwAFAAEAAAAjAP3/AwAFAAEAAAAjAPz/AwAFAAEAAAAkAPz/AwAFAAMAAAAkAP3/AwAFAAMAAAAkAP7/AwAFAAMAAAAkAP//AwAFAAMAAAAjAAAAAwAFAAMAAAAiAAAAAwAFAAMAAAAhAAAAAwAFAAMAAAAkAAAAAwAFAAMAAAAkAPv/AwAFAAEAAAAjAPv/AwAFAAEAAAAiAPv/AwAFAAEAAAAhAPv/AwAFAAEAAAAhAAEAAwAFAAMAAAAhAAIAAwAFAAMAAAAkAAEAAwAFAAMAAAAjAAEAAwAFAAMAAAAlAAAAAwAFAAMAAAAlAAEAAwAFAAMAAAAmAAEAAwAFAAEAAAAmAAIAAwAFAAEAAAAnAAIAAwAFAAEAAAAnAAEAAwAFAAEAAAAmAAAAAwAFAAMAAAAlAP//AwAFAAMAAAAlAP3/AwAFAAEAAAAlAP7/AwAFAAEAAAAmAP7/AwAFAAEAAAAmAP//AwAFAAEAAAAnAP//AwAFAAEAAAAoAP//AwAFAAEAAAAoAAAAAwAFAAEAAAAnAAAAAwAFAAEAAAAnAP7/AwAFAAEAAAAmAP3/AwAFAAEAAAAoAP7/AwAFAAEAAAApAP7/AwAFAAEAAAApAP3/AwAFAAEAAAAoAPv/AwAFAAEAAAAoAPz/AwAFAAEAAAAnA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AwAFAAMAAAAlAPv/AwAFAAMAAAAlAPz/AwAFAAMAAAAnAP3/AwAFAAEAAAAoAP3/AwAFAAEAAAAlAAIAAwAFAAMAAAA=")
|
||||||
tile_set = ExtResource("2_68wnv")
|
tile_set = ExtResource("2_68wnv")
|
||||||
|
|
||||||
|
[node name="BuildingLevel2" type="TileMapLayer" parent="Level2"]
|
||||||
|
y_sort_enabled = true
|
||||||
|
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="WaterLevel2" type="TileMapLayer" parent="Level2"]
|
[node name="WaterLevel2" type="TileMapLayer" parent="Level2"]
|
||||||
visible = false
|
visible = false
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
|
@ -60,6 +64,12 @@ y_sort_enabled = true
|
||||||
tile_map_data = PackedByteArray("AAAgAP3/AwAHAAEAAAAhAP3/AwAHAAEAAAAhAPz/AwAHAAEAAAAhAPv/AwAHAAEAAAAgAP7/AwAHAAEAAAAhAP7/AwAHAAEAAAAiAP7/AwAHAAEAAAAiAP3/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AEAAAAkAAAAAwAHAAEAAAAjAAAAAwAHAAEAAAAkAAEAAwAHAAEAAAAiAAAAAwAHAAEAAAAgAAEAAwAHAAEAAAA=")
|
||||||
tile_set = ExtResource("2_68wnv")
|
tile_set = ExtResource("2_68wnv")
|
||||||
|
|
||||||
|
[node name="BuildingLevel3" type="TileMapLayer" parent="Level3"]
|
||||||
|
y_sort_enabled = true
|
||||||
|
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="WaterLevel3" type="TileMapLayer" parent="Level3"]
|
[node name="WaterLevel3" type="TileMapLayer" parent="Level3"]
|
||||||
visible = false
|
visible = false
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
|
@ -73,6 +83,12 @@ y_sort_enabled = true
|
||||||
tile_map_data = PackedByteArray("AAAgAPv/AwAJAAEAAAAfAPr/AwAJAAEAAAAfAPv/AwAJAAEAAAAfAPn/AwAJAAEAAAAgAPn/AwAJAAEAAAAgAPr/AwAJAAEAAAAhAPr/AwAJAAEAAAAhAPn/AwAJAAEAAAAfAPz/AwAJAAEAAAAiAPn/AwAJAAEAAAAiAPr/AwAJAAEAAAAjAPn/AwAJAAEAAAA=")
|
tile_map_data = PackedByteArray("AAAgAPv/AwAJAAEAAAAfAPr/AwAJAAEAAAAfAPv/AwAJAAEAAAAfAPn/AwAJAAEAAAAgAPn/AwAJAAEAAAAgAPr/AwAJAAEAAAAhAPr/AwAJAAEAAAAhAPn/AwAJAAEAAAAfAPz/AwAJAAEAAAAiAPn/AwAJAAEAAAAiAPr/AwAJAAEAAAAjAPn/AwAJAAEAAAA=")
|
||||||
tile_set = ExtResource("2_68wnv")
|
tile_set = ExtResource("2_68wnv")
|
||||||
|
|
||||||
|
[node name="BuildingLevel4" type="TileMapLayer" parent="Level4"]
|
||||||
|
y_sort_enabled = true
|
||||||
|
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="WaterLevel4" type="TileMapLayer" parent="Level4"]
|
[node name="WaterLevel4" type="TileMapLayer" parent="Level4"]
|
||||||
visible = false
|
visible = false
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
|
@ -86,6 +102,12 @@ y_sort_enabled = true
|
||||||
tile_map_data = PackedByteArray("AAAeAPj/AwALAAEAAAAeAPn/AwALAAEAAAAfAPj/AwALAAEAAAA=")
|
tile_map_data = PackedByteArray("AAAeAPj/AwALAAEAAAAeAPn/AwALAAEAAAAfAPj/AwALAAEAAAA=")
|
||||||
tile_set = ExtResource("2_68wnv")
|
tile_set = ExtResource("2_68wnv")
|
||||||
|
|
||||||
|
[node name="BuildingLevel5" type="TileMapLayer" parent="Level5"]
|
||||||
|
y_sort_enabled = true
|
||||||
|
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="WaterLevel5" type="TileMapLayer" parent="Level5"]
|
[node name="WaterLevel5" type="TileMapLayer" parent="Level5"]
|
||||||
visible = false
|
visible = false
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
|
@ -94,28 +116,13 @@ tile_set = ExtResource("2_68wnv")
|
||||||
script = ExtResource("4_vc41k")
|
script = ExtResource("4_vc41k")
|
||||||
level = 5
|
level = 5
|
||||||
|
|
||||||
[node name="TileMap" type="TileMap" parent="."]
|
[node name="BuildingLevel6" type="TileMapLayer" parent="."]
|
||||||
visible = false
|
y_sort_enabled = true
|
||||||
tile_set = ExtResource("2_68wnv")
|
tile_set = ExtResource("2_68wnv")
|
||||||
rendering_quadrant_size = 128
|
script = ExtResource("5_3vufn")
|
||||||
format = 2
|
building_spots = Array[Vector2i]([Vector2i(29, -8), Vector2i(29, -9), Vector2i(30, -9)])
|
||||||
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"
|
|
||||||
layer_4/name = "Layer4"
|
|
||||||
layer_5/name = "Layer5"
|
|
||||||
script = ExtResource("5_v47eg")
|
|
||||||
|
|
||||||
[node name="MouseHandler" parent="TileMap" instance=ExtResource("5_6lpdu")]
|
|
||||||
position = Vector2(319, 177)
|
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="TileMap/MouseHandler"]
|
|
||||||
rotation = 0.750492
|
|
||||||
shape = SubResource("RectangleShape2D_57goo")
|
|
||||||
|
|
||||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
visible = false
|
|
||||||
|
|
||||||
[node name="UI" parent="CanvasLayer" instance=ExtResource("1_ve2mn")]
|
[node name="UI" parent="CanvasLayer" instance=ExtResource("1_ve2mn")]
|
||||||
anchors_preset = 15
|
anchors_preset = 15
|
||||||
|
@ -127,6 +134,3 @@ grow_vertical = 2
|
||||||
pivot_offset = Vector2(114, 128)
|
pivot_offset = Vector2(114, 128)
|
||||||
|
|
||||||
[node name="BuildingMenu" parent="CanvasLayer" instance=ExtResource("7_hnxcf")]
|
[node name="BuildingMenu" parent="CanvasLayer" instance=ExtResource("7_hnxcf")]
|
||||||
|
|
||||||
[connection signal="clicked" from="TileMap/MouseHandler" to="TileMap" method="_on_mouse_handler_clicked"]
|
|
||||||
[connection signal="rclicked" from="TileMap/MouseHandler" to="TileMap" method="_on_mouse_handler_rclicked"]
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ margins = Vector2i(15, 14)
|
||||||
texture_region_size = Vector2i(18, 20)
|
texture_region_size = Vector2i(18, 20)
|
||||||
1:1/0 = 0
|
1:1/0 = 0
|
||||||
0:0/0 = 0
|
0:0/0 = 0
|
||||||
|
0:0/0/texture_origin = Vector2i(0, 6)
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_w6tof"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_w6tof"]
|
||||||
texture = ExtResource("3_rchy6")
|
texture = ExtResource("3_rchy6")
|
||||||
|
|
|
@ -17,7 +17,7 @@ func _ready() -> void:
|
||||||
func _show_info_window(data):
|
func _show_info_window(data):
|
||||||
visible = true
|
visible = true
|
||||||
|
|
||||||
var building_data = Data.data.buildings[data.Key]
|
var building_data = Data.data.buildings[data.key]
|
||||||
|
|
||||||
|
|
||||||
if window_tween:
|
if window_tween:
|
||||||
|
|
15
main.gd
15
main.gd
|
@ -1 +1,16 @@
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
|
@onready var building_levels = [
|
||||||
|
$Level2/BuildingLevel2,
|
||||||
|
$Level3/BuildingLevel3,
|
||||||
|
$Level4/BuildingLevel4,
|
||||||
|
$Level5/BuildingLevel5,
|
||||||
|
$BuildingLevel6
|
||||||
|
]
|
||||||
|
|
||||||
|
func _process(delta: float) -> void:
|
||||||
|
if Input.is_action_just_released("lclick"):
|
||||||
|
if Persister.get_value("drag_mode") and Persister.get_value("building_mode"):
|
||||||
|
for build_level in building_levels:
|
||||||
|
build_level.place_building()
|
||||||
|
Persister.persist_data("building_mode", false)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
time_to_flood_change: 3
|
time_to_flood_change: 250
|
||||||
flood_levels[]
|
flood_levels[]
|
||||||
0
|
0
|
||||||
2
|
2
|
||||||
|
|
|
@ -17,11 +17,17 @@ func _on_mouse_handler_hovered() -> void:
|
||||||
|
|
||||||
func _on_mouse_handler_unhovered() -> void:
|
func _on_mouse_handler_unhovered() -> void:
|
||||||
if clicked:
|
if clicked:
|
||||||
Triggerer.trigger("drag_building", { "key": key })
|
#Triggerer.trigger("drag_building", { "key": key })
|
||||||
|
Persister.persist_data("drag_mode", true)
|
||||||
|
Persister.persist_data("building_mode", true)
|
||||||
|
Persister.persist_data("building_key", key)
|
||||||
clicked = false
|
clicked = false
|
||||||
|
|
||||||
|
|
||||||
func _on_mouse_handler_released() -> void:
|
func _on_mouse_handler_released() -> void:
|
||||||
if clicked:
|
if clicked:
|
||||||
Triggerer.trigger("select_building", { "key": key })
|
#Triggerer.trigger("select_building", { "key": key })
|
||||||
|
Persister.persist_data("drag_mode", false)
|
||||||
|
Persister.persist_data("building_mode", true)
|
||||||
|
Persister.persist_data("building_key", key)
|
||||||
clicked = false
|
clicked = false
|
||||||
|
|
Loading…
Reference in a new issue