From cddd07695d6db048dbe39254f679174d536c7d90 Mon Sep 17 00:00:00 2001 From: Ruslan Ignatov Date: Tue, 9 Dec 2025 15:59:02 +0300 Subject: [PATCH] Added active state for SelectedSectorIndicator --- game/area_map/area_map.gd | 21 +++++- .../indicators/absctact_passage_indicator.gd | 10 +-- .../absctact_passage_indicator.tscn | 4 +- .../indicators/abstract_sector_indicator.gd | 10 +-- .../indicators/abstract_sector_indicator.tscn | 4 +- .../indicators/current_sector_indicator.tscn | 48 ++++++------- .../minus_26_grad_passage_indicator.tscn | 8 +-- .../minus_45_grad_passage_indicator.tscn | 8 +-- .../plus_26_grad_passage_indicator.tscn | 8 +-- .../plus_45_grad_passage_indicator.tscn | 8 +-- .../passages/zero_grad_passage_indicator.tscn | 8 +-- .../sectors/boss_sector_indicator.tscn | 8 +-- .../sectors/debris_sector_indicator.tscn | 8 +-- .../sectors/empty_sector_indicator.tscn | 20 ------ .../sectors/repair_sector_indicator.tscn | 8 +-- .../sectors/shop_sector_indicator.tscn | 8 +-- .../sectors/start_sector_indicator.tscn | 8 +-- .../indicators/selected_sector_indicator.gd | 12 +++- .../indicators/selected_sector_indicator.tscn | 68 +++++++++++++++---- game/world/data/sector_data.gd | 3 +- game/world/generators/area_generator.gd | 2 +- game/world/generators/sector_generator.gd | 7 +- images/map.png | 4 +- 23 files changed, 168 insertions(+), 125 deletions(-) delete mode 100644 game/area_map/indicators/sectors/empty_sector_indicator.tscn diff --git a/game/area_map/area_map.gd b/game/area_map/area_map.gd index 06d6cc5..86d778a 100644 --- a/game/area_map/area_map.gd +++ b/game/area_map/area_map.gd @@ -25,8 +25,6 @@ const SECTOR_YS_FOR_THREE = [ const CURRENT_SECTOR_INDICATOR_OFFSET = Vector2(0, 16) const SECTOR_SCENES : Dictionary[SectorData.SectorType, PackedScene] = { - SectorData.SectorType.EmptySector: - preload("res://game/area_map/indicators/sectors/empty_sector_indicator.tscn"), SectorData.SectorType.ShopSector: preload("res://game/area_map/indicators/sectors/shop_sector_indicator.tscn"), SectorData.SectorType.RepairSector: @@ -196,6 +194,7 @@ func _set_current_sector(sector: SectorData) -> void: var sector_position := sector_positions[sector] current_sector_indicator.position = sector_position + CURRENT_SECTOR_INDICATOR_OFFSET + _update_selected_sector_indicator() current_sector_indicator.show() @@ -209,9 +208,27 @@ func _set_selected_sector(sector: SectorData) -> void: var sector_position := sector_positions[sector] selected_sector_indicator.position = sector_position + _update_selected_sector_indicator() selected_sector_indicator.show() +func _update_selected_sector_indicator() -> void: + if selected_sector == null: return + + var is_accessible := _is_sector_accessible(selected_sector) + selected_sector_indicator.set_active(is_accessible) + + +func _is_sector_accessible(sector: SectorData) -> bool: + if current_sector == null: return false + + for passage in current_sector.next_passages: + if passage.next_sector == sector: + return true + + return false + + func _on_test_timer_timeout() -> void: test_seed += 1 area_data = test_area_generator.generate(test_seed) diff --git a/game/area_map/indicators/absctact_passage_indicator.gd b/game/area_map/indicators/absctact_passage_indicator.gd index cacb1ea..d567a5a 100644 --- a/game/area_map/indicators/absctact_passage_indicator.gd +++ b/game/area_map/indicators/absctact_passage_indicator.gd @@ -2,14 +2,14 @@ class_name AbstractPassageIndicator extends Node2D -@onready var active_texture : Sprite2D = $ActiveTexture -@onready var inactive_texture : Sprite2D = $InactiveTexture +@onready var active_sprite : Sprite2D = $ActiveSprite +@onready var inactive_sprite : Sprite2D = $InactiveSprite func _ready() -> void: - inactive_texture.hide() + inactive_sprite.hide() func set_active(is_active: bool) -> void: - active_texture.visible = is_active - inactive_texture.visible = not is_active + active_sprite.visible = is_active + inactive_sprite.visible = not is_active diff --git a/game/area_map/indicators/absctact_passage_indicator.tscn b/game/area_map/indicators/absctact_passage_indicator.tscn index a1ac3c7..8a1c40e 100644 --- a/game/area_map/indicators/absctact_passage_indicator.tscn +++ b/game/area_map/indicators/absctact_passage_indicator.tscn @@ -5,6 +5,6 @@ [node name="AbsctactPassageIndicator" type="Node2D"] script = ExtResource("1_c886g") -[node name="ActiveTexture" type="Sprite2D" parent="."] +[node name="ActiveSprite" type="Sprite2D" parent="."] -[node name="InactiveTexture" type="Sprite2D" parent="."] +[node name="InactiveSprite" type="Sprite2D" parent="."] diff --git a/game/area_map/indicators/abstract_sector_indicator.gd b/game/area_map/indicators/abstract_sector_indicator.gd index dcbcc1f..8473aac 100644 --- a/game/area_map/indicators/abstract_sector_indicator.gd +++ b/game/area_map/indicators/abstract_sector_indicator.gd @@ -2,14 +2,14 @@ class_name AbstractSectorIndicator extends Node2D -@onready var active_texture : Sprite2D = $ActiveTexture -@onready var inactive_texture : Sprite2D = $InactiveTexture +@onready var active_sprite : Sprite2D = $ActiveSprite +@onready var inactive_sprite : Sprite2D = $InactiveSprite func _ready() -> void: - inactive_texture.hide() + inactive_sprite.hide() func set_active(is_active: bool) -> void: - active_texture.visible = is_active - inactive_texture.visible = not is_active + active_sprite.visible = is_active + inactive_sprite.visible = not is_active diff --git a/game/area_map/indicators/abstract_sector_indicator.tscn b/game/area_map/indicators/abstract_sector_indicator.tscn index 21e06a0..c38bb16 100644 --- a/game/area_map/indicators/abstract_sector_indicator.tscn +++ b/game/area_map/indicators/abstract_sector_indicator.tscn @@ -5,6 +5,6 @@ [node name="AbstractSectorIndicator" type="Node2D"] script = ExtResource("1_mp2r3") -[node name="ActiveTexture" type="Sprite2D" parent="."] +[node name="ActiveSprite" type="Sprite2D" parent="."] -[node name="InactiveTexture" type="Sprite2D" parent="."] +[node name="InactiveSprite" type="Sprite2D" parent="."] diff --git a/game/area_map/indicators/current_sector_indicator.tscn b/game/area_map/indicators/current_sector_indicator.tscn index fac70ce..fabc696 100644 --- a/game/area_map/indicators/current_sector_indicator.tscn +++ b/game/area_map/indicators/current_sector_indicator.tscn @@ -3,64 +3,64 @@ [ext_resource type="Script" uid="uid://yf2bef674enx" path="res://game/area_map/indicators/current_sector_indicator.gd" id="1_7irmv"] [ext_resource type="Texture2D" uid="uid://orutjsnhhruf" path="res://images/map.png" id="2_l75qw"] -[sub_resource type="AtlasTexture" id="AtlasTexture_iqys3"] +[sub_resource type="AtlasTexture" id="AtlasTexture_uvh02"] atlas = ExtResource("2_l75qw") -region = Rect2(256, 0, 16, 16) +region = Rect2(0, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_ua7c8"] +[sub_resource type="AtlasTexture" id="AtlasTexture_ae7s5"] atlas = ExtResource("2_l75qw") -region = Rect2(272, 0, 16, 16) +region = Rect2(16, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_8a5ox"] +[sub_resource type="AtlasTexture" id="AtlasTexture_n55qr"] atlas = ExtResource("2_l75qw") -region = Rect2(288, 0, 16, 16) +region = Rect2(32, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_nmkab"] +[sub_resource type="AtlasTexture" id="AtlasTexture_h4hjk"] atlas = ExtResource("2_l75qw") -region = Rect2(304, 0, 16, 16) +region = Rect2(48, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_a5b5h"] +[sub_resource type="AtlasTexture" id="AtlasTexture_7neat"] atlas = ExtResource("2_l75qw") -region = Rect2(256, 16, 16, 16) +region = Rect2(64, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_gekak"] +[sub_resource type="AtlasTexture" id="AtlasTexture_vo826"] atlas = ExtResource("2_l75qw") -region = Rect2(272, 16, 16, 16) +region = Rect2(80, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_02s10"] +[sub_resource type="AtlasTexture" id="AtlasTexture_5ynnd"] atlas = ExtResource("2_l75qw") -region = Rect2(288, 16, 16, 16) +region = Rect2(96, 0, 16, 16) -[sub_resource type="AtlasTexture" id="AtlasTexture_do7pi"] +[sub_resource type="AtlasTexture" id="AtlasTexture_0qk8c"] atlas = ExtResource("2_l75qw") -region = Rect2(304, 16, 16, 16) +region = Rect2(112, 0, 16, 16) [sub_resource type="SpriteFrames" id="SpriteFrames_2biry"] animations = [{ "frames": [{ "duration": 25.0, -"texture": SubResource("AtlasTexture_iqys3") +"texture": SubResource("AtlasTexture_uvh02") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_ua7c8") +"texture": SubResource("AtlasTexture_ae7s5") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_8a5ox") +"texture": SubResource("AtlasTexture_n55qr") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_nmkab") +"texture": SubResource("AtlasTexture_h4hjk") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_a5b5h") +"texture": SubResource("AtlasTexture_7neat") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_gekak") +"texture": SubResource("AtlasTexture_vo826") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_02s10") +"texture": SubResource("AtlasTexture_5ynnd") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_do7pi") +"texture": SubResource("AtlasTexture_0qk8c") }], "loop": true, "name": &"animation", diff --git a/game/area_map/indicators/passages/minus_26_grad_passage_indicator.tscn b/game/area_map/indicators/passages/minus_26_grad_passage_indicator.tscn index 215d439..0490ac9 100644 --- a/game/area_map/indicators/passages/minus_26_grad_passage_indicator.tscn +++ b/game/area_map/indicators/passages/minus_26_grad_passage_indicator.tscn @@ -5,18 +5,18 @@ [sub_resource type="AtlasTexture" id="AtlasTexture_dencp"] atlas = ExtResource("2_ihw22") -region = Rect2(80, 48, 80, 48) +region = Rect2(80, 64, 80, 48) [sub_resource type="AtlasTexture" id="AtlasTexture_3eblp"] atlas = ExtResource("2_ihw22") -region = Rect2(240, 48, 80, 48) +region = Rect2(240, 64, 80, 48) [node name="PassageIndicatorMinus26Grad" instance=ExtResource("1_6yx0l")] -[node name="ActiveTexture" parent="." index="0"] +[node name="ActiveSprite" parent="." index="0"] position = Vector2(32, -16) texture = SubResource("AtlasTexture_dencp") -[node name="InactiveTexture" parent="." index="1"] +[node name="InactiveSprite" parent="." index="1"] position = Vector2(32, -16) texture = SubResource("AtlasTexture_3eblp") diff --git a/game/area_map/indicators/passages/minus_45_grad_passage_indicator.tscn b/game/area_map/indicators/passages/minus_45_grad_passage_indicator.tscn index 002e5da..c4bfef7 100644 --- a/game/area_map/indicators/passages/minus_45_grad_passage_indicator.tscn +++ b/game/area_map/indicators/passages/minus_45_grad_passage_indicator.tscn @@ -5,18 +5,18 @@ [sub_resource type="AtlasTexture" id="AtlasTexture_auxhg"] atlas = ExtResource("2_o52wh") -region = Rect2(80, 96, 80, 80) +region = Rect2(80, 112, 80, 80) [sub_resource type="AtlasTexture" id="AtlasTexture_8xe3k"] atlas = ExtResource("2_o52wh") -region = Rect2(240, 96, 80, 80) +region = Rect2(240, 112, 80, 80) [node name="PassageIndicatorMinus45Grad" instance=ExtResource("1_ejr0u")] -[node name="ActiveTexture" parent="." index="0"] +[node name="ActiveSprite" parent="." index="0"] position = Vector2(32, -32) texture = SubResource("AtlasTexture_auxhg") -[node name="InactiveTexture" parent="." index="1"] +[node name="InactiveSprite" parent="." index="1"] position = Vector2(32, -32) texture = SubResource("AtlasTexture_8xe3k") diff --git a/game/area_map/indicators/passages/plus_26_grad_passage_indicator.tscn b/game/area_map/indicators/passages/plus_26_grad_passage_indicator.tscn index b407b79..8803f47 100644 --- a/game/area_map/indicators/passages/plus_26_grad_passage_indicator.tscn +++ b/game/area_map/indicators/passages/plus_26_grad_passage_indicator.tscn @@ -5,18 +5,18 @@ [sub_resource type="AtlasTexture" id="AtlasTexture_o7a4k"] atlas = ExtResource("2_ugcaf") -region = Rect2(0, 48, 80, 48) +region = Rect2(0, 64, 80, 48) [sub_resource type="AtlasTexture" id="AtlasTexture_ghd4p"] atlas = ExtResource("2_ugcaf") -region = Rect2(160, 48, 80, 48) +region = Rect2(160, 64, 80, 48) [node name="PassageIndicator26Grad" instance=ExtResource("1_ke7h2")] -[node name="ActiveTexture" parent="." index="0"] +[node name="ActiveSprite" parent="." index="0"] position = Vector2(32, 16) texture = SubResource("AtlasTexture_o7a4k") -[node name="InactiveTexture" parent="." index="1"] +[node name="InactiveSprite" parent="." index="1"] position = Vector2(32, 16) texture = SubResource("AtlasTexture_ghd4p") diff --git a/game/area_map/indicators/passages/plus_45_grad_passage_indicator.tscn b/game/area_map/indicators/passages/plus_45_grad_passage_indicator.tscn index 5330df7..9b97106 100644 --- a/game/area_map/indicators/passages/plus_45_grad_passage_indicator.tscn +++ b/game/area_map/indicators/passages/plus_45_grad_passage_indicator.tscn @@ -5,18 +5,18 @@ [sub_resource type="AtlasTexture" id="AtlasTexture_1wcf5"] atlas = ExtResource("2_qtofm") -region = Rect2(0, 96, 80, 80) +region = Rect2(0, 112, 80, 80) [sub_resource type="AtlasTexture" id="AtlasTexture_lqbnh"] atlas = ExtResource("2_qtofm") -region = Rect2(160, 96, 80, 80) +region = Rect2(160, 112, 80, 80) [node name="PassageIndicator45Grad" instance=ExtResource("1_nk4h4")] -[node name="ActiveTexture" parent="." index="0"] +[node name="ActiveSprite" parent="." index="0"] position = Vector2(32, 32) texture = SubResource("AtlasTexture_1wcf5") -[node name="InactiveTexture" parent="." index="1"] +[node name="InactiveSprite" parent="." index="1"] position = Vector2(32, 32) texture = SubResource("AtlasTexture_lqbnh") diff --git a/game/area_map/indicators/passages/zero_grad_passage_indicator.tscn b/game/area_map/indicators/passages/zero_grad_passage_indicator.tscn index ef5170c..6074584 100644 --- a/game/area_map/indicators/passages/zero_grad_passage_indicator.tscn +++ b/game/area_map/indicators/passages/zero_grad_passage_indicator.tscn @@ -5,18 +5,18 @@ [sub_resource type="AtlasTexture" id="AtlasTexture_f73ej"] atlas = ExtResource("2_4t74o") -region = Rect2(0, 32, 80, 16) +region = Rect2(0, 48, 80, 16) [sub_resource type="AtlasTexture" id="AtlasTexture_b8pmf"] atlas = ExtResource("2_4t74o") -region = Rect2(160, 32, 80, 16) +region = Rect2(160, 48, 80, 16) [node name="PassageIndicator0Grad" instance=ExtResource("1_q65pt")] -[node name="ActiveTexture" parent="." index="0"] +[node name="ActiveSprite" parent="." index="0"] position = Vector2(32, 0) texture = SubResource("AtlasTexture_f73ej") -[node name="InactiveTexture" parent="." index="1"] +[node name="InactiveSprite" parent="." index="1"] position = Vector2(32, 0) texture = SubResource("AtlasTexture_b8pmf") diff --git a/game/area_map/indicators/sectors/boss_sector_indicator.tscn b/game/area_map/indicators/sectors/boss_sector_indicator.tscn index cac6935..96c8554 100644 --- a/game/area_map/indicators/sectors/boss_sector_indicator.tscn +++ b/game/area_map/indicators/sectors/boss_sector_indicator.tscn @@ -5,16 +5,16 @@ [sub_resource type="AtlasTexture" id="AtlasTexture_qx624"] atlas = ExtResource("2_t7m7p") -region = Rect2(80, 0, 16, 16) +region = Rect2(144, 48, 16, 16) [sub_resource type="AtlasTexture" id="AtlasTexture_t7m7p"] atlas = ExtResource("2_t7m7p") -region = Rect2(80, 16, 16, 16) +region = Rect2(304, 48, 16, 16) [node name="BossSectorIndicator" instance=ExtResource("1_qx624")] -[node name="ActiveTexture" parent="." index="0"] +[node name="ActiveSprite" parent="." index="0"] texture = SubResource("AtlasTexture_qx624") -[node name="InactiveTexture" parent="." index="1"] +[node name="InactiveSprite" parent="." index="1"] texture = SubResource("AtlasTexture_t7m7p") diff --git a/game/area_map/indicators/sectors/debris_sector_indicator.tscn b/game/area_map/indicators/sectors/debris_sector_indicator.tscn index 4a4e94b..25a41d1 100644 --- a/game/area_map/indicators/sectors/debris_sector_indicator.tscn +++ b/game/area_map/indicators/sectors/debris_sector_indicator.tscn @@ -5,16 +5,16 @@ [sub_resource type="AtlasTexture" id="AtlasTexture_1il3o"] atlas = ExtResource("2_yiddm") -region = Rect2(48, 0, 16, 16) +region = Rect2(96, 48, 16, 16) [sub_resource type="AtlasTexture" id="AtlasTexture_yiddm"] atlas = ExtResource("2_yiddm") -region = Rect2(48, 16, 16, 16) +region = Rect2(256, 48, 16, 16) [node name="DebrisSectorIndicator" instance=ExtResource("1_1il3o")] -[node name="ActiveTexture" parent="." index="0"] +[node name="ActiveSprite" parent="." index="0"] texture = SubResource("AtlasTexture_1il3o") -[node name="InactiveTexture" parent="." index="1"] +[node name="InactiveSprite" parent="." index="1"] texture = SubResource("AtlasTexture_yiddm") diff --git a/game/area_map/indicators/sectors/empty_sector_indicator.tscn b/game/area_map/indicators/sectors/empty_sector_indicator.tscn deleted file mode 100644 index 48b9044..0000000 --- a/game/area_map/indicators/sectors/empty_sector_indicator.tscn +++ /dev/null @@ -1,20 +0,0 @@ -[gd_scene load_steps=5 format=3 uid="uid://bmhjspcsdim4a"] - -[ext_resource type="PackedScene" uid="uid://bofxdki5oelxe" path="res://game/area_map/indicators/abstract_sector_indicator.tscn" id="1_ywgpn"] -[ext_resource type="Texture2D" uid="uid://orutjsnhhruf" path="res://images/map.png" id="2_p04dw"] - -[sub_resource type="AtlasTexture" id="AtlasTexture_ywgpn"] -atlas = ExtResource("2_p04dw") -region = Rect2(0, 0, 16, 16) - -[sub_resource type="AtlasTexture" id="AtlasTexture_p04dw"] -atlas = ExtResource("2_p04dw") -region = Rect2(0, 16, 16, 16) - -[node name="EmptySectorIndicator" instance=ExtResource("1_ywgpn")] - -[node name="ActiveTexture" parent="." index="0"] -texture = SubResource("AtlasTexture_ywgpn") - -[node name="InactiveTexture" parent="." index="1"] -texture = SubResource("AtlasTexture_p04dw") diff --git a/game/area_map/indicators/sectors/repair_sector_indicator.tscn b/game/area_map/indicators/sectors/repair_sector_indicator.tscn index 9faded8..c054243 100644 --- a/game/area_map/indicators/sectors/repair_sector_indicator.tscn +++ b/game/area_map/indicators/sectors/repair_sector_indicator.tscn @@ -5,16 +5,16 @@ [sub_resource type="AtlasTexture" id="AtlasTexture_5phms"] atlas = ExtResource("2_e1mcs") -region = Rect2(32, 0, 16, 16) +region = Rect2(128, 48, 16, 16) [sub_resource type="AtlasTexture" id="AtlasTexture_e1mcs"] atlas = ExtResource("2_e1mcs") -region = Rect2(32, 16, 16, 16) +region = Rect2(288, 48, 16, 16) [node name="RepairSectorIndicator" instance=ExtResource("1_5phms")] -[node name="ActiveTexture" parent="." index="0"] +[node name="ActiveSprite" parent="." index="0"] texture = SubResource("AtlasTexture_5phms") -[node name="InactiveTexture" parent="." index="1"] +[node name="InactiveSprite" parent="." index="1"] texture = SubResource("AtlasTexture_e1mcs") diff --git a/game/area_map/indicators/sectors/shop_sector_indicator.tscn b/game/area_map/indicators/sectors/shop_sector_indicator.tscn index 343e5ee..e7253bb 100644 --- a/game/area_map/indicators/sectors/shop_sector_indicator.tscn +++ b/game/area_map/indicators/sectors/shop_sector_indicator.tscn @@ -5,16 +5,16 @@ [sub_resource type="AtlasTexture" id="AtlasTexture_4uu3o"] atlas = ExtResource("2_j10ah") -region = Rect2(16, 0, 16, 16) +region = Rect2(112, 48, 16, 16) [sub_resource type="AtlasTexture" id="AtlasTexture_j10ah"] atlas = ExtResource("2_j10ah") -region = Rect2(16, 16, 16, 16) +region = Rect2(272, 48, 16, 16) [node name="ShopSectorIndicator" instance=ExtResource("1_4uu3o")] -[node name="ActiveTexture" parent="." index="0"] +[node name="ActiveSprite" parent="." index="0"] texture = SubResource("AtlasTexture_4uu3o") -[node name="InactiveTexture" parent="." index="1"] +[node name="InactiveSprite" parent="." index="1"] texture = SubResource("AtlasTexture_j10ah") diff --git a/game/area_map/indicators/sectors/start_sector_indicator.tscn b/game/area_map/indicators/sectors/start_sector_indicator.tscn index 0516450..4442fbc 100644 --- a/game/area_map/indicators/sectors/start_sector_indicator.tscn +++ b/game/area_map/indicators/sectors/start_sector_indicator.tscn @@ -5,16 +5,16 @@ [sub_resource type="AtlasTexture" id="AtlasTexture_glpdm"] atlas = ExtResource("2_37krw") -region = Rect2(64, 0, 16, 16) +region = Rect2(80, 48, 16, 16) [sub_resource type="AtlasTexture" id="AtlasTexture_37krw"] atlas = ExtResource("2_37krw") -region = Rect2(64, 16, 16, 16) +region = Rect2(80, 48, 16, 16) [node name="StartSectorIndicator" instance=ExtResource("1_glpdm")] -[node name="ActiveTexture" parent="." index="0"] +[node name="ActiveSprite" parent="." index="0"] texture = SubResource("AtlasTexture_glpdm") -[node name="InactiveTexture" parent="." index="1"] +[node name="InactiveSprite" parent="." index="1"] texture = SubResource("AtlasTexture_37krw") diff --git a/game/area_map/indicators/selected_sector_indicator.gd b/game/area_map/indicators/selected_sector_indicator.gd index f892889..c47f853 100644 --- a/game/area_map/indicators/selected_sector_indicator.gd +++ b/game/area_map/indicators/selected_sector_indicator.gd @@ -5,8 +5,16 @@ extends Node2D const ANIMATION = "animation" -@onready var sprite : AnimatedSprite2D = $AnimatedSprite2D +@onready var active_sprite : AnimatedSprite2D = $ActiveSprite +@onready var inactive_sprite : AnimatedSprite2D = $InactiveSprite func _ready() -> void: - sprite.play(ANIMATION) + active_sprite.play(ANIMATION) + inactive_sprite.play(ANIMATION) + inactive_sprite.hide() + + +func set_active(is_active: bool) -> void: + active_sprite.visible = is_active + inactive_sprite.visible = not is_active diff --git a/game/area_map/indicators/selected_sector_indicator.tscn b/game/area_map/indicators/selected_sector_indicator.tscn index da14f8b..468cf84 100644 --- a/game/area_map/indicators/selected_sector_indicator.tscn +++ b/game/area_map/indicators/selected_sector_indicator.tscn @@ -1,38 +1,74 @@ -[gd_scene load_steps=8 format=3 uid="uid://bwru7i7xetjth"] +[gd_scene load_steps=13 format=3 uid="uid://bwru7i7xetjth"] [ext_resource type="Script" uid="uid://d3eqb5341h7y0" path="res://game/area_map/indicators/selected_sector_indicator.gd" id="1_06a3o"] [ext_resource type="Texture2D" uid="uid://orutjsnhhruf" path="res://images/map.png" id="2_485wc"] -[sub_resource type="AtlasTexture" id="AtlasTexture_gx6w1"] +[sub_resource type="AtlasTexture" id="AtlasTexture_eud2k"] atlas = ExtResource("2_485wc") -region = Rect2(128, 0, 32, 32) +region = Rect2(0, 16, 32, 32) -[sub_resource type="AtlasTexture" id="AtlasTexture_igqhl"] +[sub_resource type="AtlasTexture" id="AtlasTexture_m1mdo"] atlas = ExtResource("2_485wc") -region = Rect2(160, 0, 32, 32) +region = Rect2(32, 16, 32, 32) -[sub_resource type="AtlasTexture" id="AtlasTexture_5vw2o"] +[sub_resource type="AtlasTexture" id="AtlasTexture_84eqk"] atlas = ExtResource("2_485wc") -region = Rect2(192, 0, 32, 32) +region = Rect2(64, 16, 32, 32) -[sub_resource type="AtlasTexture" id="AtlasTexture_ih4lp"] +[sub_resource type="AtlasTexture" id="AtlasTexture_5un7b"] atlas = ExtResource("2_485wc") -region = Rect2(224, 0, 32, 32) +region = Rect2(96, 16, 32, 32) [sub_resource type="SpriteFrames" id="SpriteFrames_5e44l"] animations = [{ "frames": [{ "duration": 25.0, -"texture": SubResource("AtlasTexture_gx6w1") +"texture": SubResource("AtlasTexture_eud2k") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_igqhl") +"texture": SubResource("AtlasTexture_m1mdo") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_5vw2o") +"texture": SubResource("AtlasTexture_84eqk") }, { "duration": 1.0, -"texture": SubResource("AtlasTexture_ih4lp") +"texture": SubResource("AtlasTexture_5un7b") +}], +"loop": true, +"name": &"animation", +"speed": 10.0 +}] + +[sub_resource type="AtlasTexture" id="AtlasTexture_k4cjf"] +atlas = ExtResource("2_485wc") +region = Rect2(160, 16, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_7sd5s"] +atlas = ExtResource("2_485wc") +region = Rect2(192, 16, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_knx1i"] +atlas = ExtResource("2_485wc") +region = Rect2(224, 16, 32, 32) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ii6pb"] +atlas = ExtResource("2_485wc") +region = Rect2(256, 16, 32, 32) + +[sub_resource type="SpriteFrames" id="SpriteFrames_ulua7"] +animations = [{ +"frames": [{ +"duration": 25.0, +"texture": SubResource("AtlasTexture_k4cjf") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_7sd5s") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_knx1i") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_ii6pb") }], "loop": true, "name": &"animation", @@ -42,6 +78,10 @@ animations = [{ [node name="SelectedSectorIndicator" type="Node2D"] script = ExtResource("1_06a3o") -[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +[node name="ActiveSprite" type="AnimatedSprite2D" parent="."] sprite_frames = SubResource("SpriteFrames_5e44l") animation = &"animation" + +[node name="InactiveSprite" type="AnimatedSprite2D" parent="."] +sprite_frames = SubResource("SpriteFrames_ulua7") +animation = &"animation" diff --git a/game/world/data/sector_data.gd b/game/world/data/sector_data.gd index f85193f..4882e4d 100644 --- a/game/world/data/sector_data.gd +++ b/game/world/data/sector_data.gd @@ -6,7 +6,6 @@ signal activity_changed(is_active: bool) enum SectorType { - EmptySector, ShopSector, RepairSector, DebrisSector, @@ -20,7 +19,7 @@ enum SectorType { @export var seed_value : int = 0 -@export var type : SectorType = SectorType.EmptySector +@export var type : SectorType = SectorType.DebrisSector var is_active: bool = true: diff --git a/game/world/generators/area_generator.gd b/game/world/generators/area_generator.gd index d5a4c73..15c8d3b 100644 --- a/game/world/generators/area_generator.gd +++ b/game/world/generators/area_generator.gd @@ -44,7 +44,7 @@ var passage_direction_rng : RandomNumberGenerator = RandomNumberGenerator.new() @onready var passage_generator : PassageGenerator = $PassageGenerator -func generate(seed_value: int) -> AreaData: +func generate(seed_value: int) -> AreaData: local_seed_rng.seed = seed_value stage_seed_rng.seed = local_seed_rng.randi() passage_seed_rng.seed = local_seed_rng.randi() diff --git a/game/world/generators/sector_generator.gd b/game/world/generators/sector_generator.gd index eadd576..c26921e 100644 --- a/game/world/generators/sector_generator.gd +++ b/game/world/generators/sector_generator.gd @@ -3,10 +3,9 @@ extends Node const CHANSES_BY_SECTOR_TYPE : Dictionary[SectorData.SectorType, int] = { - SectorData.SectorType.EmptySector: 45, - SectorData.SectorType.ShopSector: 30, + SectorData.SectorType.ShopSector: 40, SectorData.SectorType.RepairSector: 20, - SectorData.SectorType.DebrisSector: 5, + SectorData.SectorType.DebrisSector: 40, } @@ -39,4 +38,4 @@ func _get_sector_type() -> SectorData.SectorType: if threshold <= cumulative: return type - return SectorData.SectorType.EmptySector + return SectorData.SectorType.DebrisSector diff --git a/images/map.png b/images/map.png index 02b8804..b467d4b 100644 --- a/images/map.png +++ b/images/map.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e0dbad7ad52c0da88f22087913d0a428082ba672c449e83b50db5b8aa5310316 -size 2169 +oid sha256:b03df9b50d3f36c4e3719b20d4ba5246edcd0d4e7cea679e4e21e988ac0c22e9 +size 2265