Added active state for SelectedSectorIndicator

This commit is contained in:
2025-12-09 15:59:02 +03:00
parent 250a36bab3
commit cddd07695d
23 changed files with 168 additions and 125 deletions
+19 -2
View File
@@ -25,8 +25,6 @@ const SECTOR_YS_FOR_THREE = [
const CURRENT_SECTOR_INDICATOR_OFFSET = Vector2(0, 16) const CURRENT_SECTOR_INDICATOR_OFFSET = Vector2(0, 16)
const SECTOR_SCENES : Dictionary[SectorData.SectorType, PackedScene] = { const SECTOR_SCENES : Dictionary[SectorData.SectorType, PackedScene] = {
SectorData.SectorType.EmptySector:
preload("res://game/area_map/indicators/sectors/empty_sector_indicator.tscn"),
SectorData.SectorType.ShopSector: SectorData.SectorType.ShopSector:
preload("res://game/area_map/indicators/sectors/shop_sector_indicator.tscn"), preload("res://game/area_map/indicators/sectors/shop_sector_indicator.tscn"),
SectorData.SectorType.RepairSector: SectorData.SectorType.RepairSector:
@@ -196,6 +194,7 @@ func _set_current_sector(sector: SectorData) -> void:
var sector_position := sector_positions[sector] var sector_position := sector_positions[sector]
current_sector_indicator.position = sector_position + CURRENT_SECTOR_INDICATOR_OFFSET current_sector_indicator.position = sector_position + CURRENT_SECTOR_INDICATOR_OFFSET
_update_selected_sector_indicator()
current_sector_indicator.show() current_sector_indicator.show()
@@ -209,9 +208,27 @@ func _set_selected_sector(sector: SectorData) -> void:
var sector_position := sector_positions[sector] var sector_position := sector_positions[sector]
selected_sector_indicator.position = sector_position selected_sector_indicator.position = sector_position
_update_selected_sector_indicator()
selected_sector_indicator.show() 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: func _on_test_timer_timeout() -> void:
test_seed += 1 test_seed += 1
area_data = test_area_generator.generate(test_seed) area_data = test_area_generator.generate(test_seed)
@@ -2,14 +2,14 @@ class_name AbstractPassageIndicator
extends Node2D extends Node2D
@onready var active_texture : Sprite2D = $ActiveTexture @onready var active_sprite : Sprite2D = $ActiveSprite
@onready var inactive_texture : Sprite2D = $InactiveTexture @onready var inactive_sprite : Sprite2D = $InactiveSprite
func _ready() -> void: func _ready() -> void:
inactive_texture.hide() inactive_sprite.hide()
func set_active(is_active: bool) -> void: func set_active(is_active: bool) -> void:
active_texture.visible = is_active active_sprite.visible = is_active
inactive_texture.visible = not is_active inactive_sprite.visible = not is_active
@@ -5,6 +5,6 @@
[node name="AbsctactPassageIndicator" type="Node2D"] [node name="AbsctactPassageIndicator" type="Node2D"]
script = ExtResource("1_c886g") 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="."]
@@ -2,14 +2,14 @@ class_name AbstractSectorIndicator
extends Node2D extends Node2D
@onready var active_texture : Sprite2D = $ActiveTexture @onready var active_sprite : Sprite2D = $ActiveSprite
@onready var inactive_texture : Sprite2D = $InactiveTexture @onready var inactive_sprite : Sprite2D = $InactiveSprite
func _ready() -> void: func _ready() -> void:
inactive_texture.hide() inactive_sprite.hide()
func set_active(is_active: bool) -> void: func set_active(is_active: bool) -> void:
active_texture.visible = is_active active_sprite.visible = is_active
inactive_texture.visible = not is_active inactive_sprite.visible = not is_active
@@ -5,6 +5,6 @@
[node name="AbstractSectorIndicator" type="Node2D"] [node name="AbstractSectorIndicator" type="Node2D"]
script = ExtResource("1_mp2r3") 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="."]
@@ -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="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"] [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") 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") 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") 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") 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") 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") 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") 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") atlas = ExtResource("2_l75qw")
region = Rect2(304, 16, 16, 16) region = Rect2(112, 0, 16, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_2biry"] [sub_resource type="SpriteFrames" id="SpriteFrames_2biry"]
animations = [{ animations = [{
"frames": [{ "frames": [{
"duration": 25.0, "duration": 25.0,
"texture": SubResource("AtlasTexture_iqys3") "texture": SubResource("AtlasTexture_uvh02")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_ua7c8") "texture": SubResource("AtlasTexture_ae7s5")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_8a5ox") "texture": SubResource("AtlasTexture_n55qr")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_nmkab") "texture": SubResource("AtlasTexture_h4hjk")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_a5b5h") "texture": SubResource("AtlasTexture_7neat")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_gekak") "texture": SubResource("AtlasTexture_vo826")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_02s10") "texture": SubResource("AtlasTexture_5ynnd")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_do7pi") "texture": SubResource("AtlasTexture_0qk8c")
}], }],
"loop": true, "loop": true,
"name": &"animation", "name": &"animation",
@@ -5,18 +5,18 @@
[sub_resource type="AtlasTexture" id="AtlasTexture_dencp"] [sub_resource type="AtlasTexture" id="AtlasTexture_dencp"]
atlas = ExtResource("2_ihw22") atlas = ExtResource("2_ihw22")
region = Rect2(80, 48, 80, 48) region = Rect2(80, 64, 80, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_3eblp"] [sub_resource type="AtlasTexture" id="AtlasTexture_3eblp"]
atlas = ExtResource("2_ihw22") 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="PassageIndicatorMinus26Grad" instance=ExtResource("1_6yx0l")]
[node name="ActiveTexture" parent="." index="0"] [node name="ActiveSprite" parent="." index="0"]
position = Vector2(32, -16) position = Vector2(32, -16)
texture = SubResource("AtlasTexture_dencp") texture = SubResource("AtlasTexture_dencp")
[node name="InactiveTexture" parent="." index="1"] [node name="InactiveSprite" parent="." index="1"]
position = Vector2(32, -16) position = Vector2(32, -16)
texture = SubResource("AtlasTexture_3eblp") texture = SubResource("AtlasTexture_3eblp")
@@ -5,18 +5,18 @@
[sub_resource type="AtlasTexture" id="AtlasTexture_auxhg"] [sub_resource type="AtlasTexture" id="AtlasTexture_auxhg"]
atlas = ExtResource("2_o52wh") atlas = ExtResource("2_o52wh")
region = Rect2(80, 96, 80, 80) region = Rect2(80, 112, 80, 80)
[sub_resource type="AtlasTexture" id="AtlasTexture_8xe3k"] [sub_resource type="AtlasTexture" id="AtlasTexture_8xe3k"]
atlas = ExtResource("2_o52wh") 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="PassageIndicatorMinus45Grad" instance=ExtResource("1_ejr0u")]
[node name="ActiveTexture" parent="." index="0"] [node name="ActiveSprite" parent="." index="0"]
position = Vector2(32, -32) position = Vector2(32, -32)
texture = SubResource("AtlasTexture_auxhg") texture = SubResource("AtlasTexture_auxhg")
[node name="InactiveTexture" parent="." index="1"] [node name="InactiveSprite" parent="." index="1"]
position = Vector2(32, -32) position = Vector2(32, -32)
texture = SubResource("AtlasTexture_8xe3k") texture = SubResource("AtlasTexture_8xe3k")
@@ -5,18 +5,18 @@
[sub_resource type="AtlasTexture" id="AtlasTexture_o7a4k"] [sub_resource type="AtlasTexture" id="AtlasTexture_o7a4k"]
atlas = ExtResource("2_ugcaf") atlas = ExtResource("2_ugcaf")
region = Rect2(0, 48, 80, 48) region = Rect2(0, 64, 80, 48)
[sub_resource type="AtlasTexture" id="AtlasTexture_ghd4p"] [sub_resource type="AtlasTexture" id="AtlasTexture_ghd4p"]
atlas = ExtResource("2_ugcaf") 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="PassageIndicator26Grad" instance=ExtResource("1_ke7h2")]
[node name="ActiveTexture" parent="." index="0"] [node name="ActiveSprite" parent="." index="0"]
position = Vector2(32, 16) position = Vector2(32, 16)
texture = SubResource("AtlasTexture_o7a4k") texture = SubResource("AtlasTexture_o7a4k")
[node name="InactiveTexture" parent="." index="1"] [node name="InactiveSprite" parent="." index="1"]
position = Vector2(32, 16) position = Vector2(32, 16)
texture = SubResource("AtlasTexture_ghd4p") texture = SubResource("AtlasTexture_ghd4p")
@@ -5,18 +5,18 @@
[sub_resource type="AtlasTexture" id="AtlasTexture_1wcf5"] [sub_resource type="AtlasTexture" id="AtlasTexture_1wcf5"]
atlas = ExtResource("2_qtofm") atlas = ExtResource("2_qtofm")
region = Rect2(0, 96, 80, 80) region = Rect2(0, 112, 80, 80)
[sub_resource type="AtlasTexture" id="AtlasTexture_lqbnh"] [sub_resource type="AtlasTexture" id="AtlasTexture_lqbnh"]
atlas = ExtResource("2_qtofm") 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="PassageIndicator45Grad" instance=ExtResource("1_nk4h4")]
[node name="ActiveTexture" parent="." index="0"] [node name="ActiveSprite" parent="." index="0"]
position = Vector2(32, 32) position = Vector2(32, 32)
texture = SubResource("AtlasTexture_1wcf5") texture = SubResource("AtlasTexture_1wcf5")
[node name="InactiveTexture" parent="." index="1"] [node name="InactiveSprite" parent="." index="1"]
position = Vector2(32, 32) position = Vector2(32, 32)
texture = SubResource("AtlasTexture_lqbnh") texture = SubResource("AtlasTexture_lqbnh")
@@ -5,18 +5,18 @@
[sub_resource type="AtlasTexture" id="AtlasTexture_f73ej"] [sub_resource type="AtlasTexture" id="AtlasTexture_f73ej"]
atlas = ExtResource("2_4t74o") atlas = ExtResource("2_4t74o")
region = Rect2(0, 32, 80, 16) region = Rect2(0, 48, 80, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_b8pmf"] [sub_resource type="AtlasTexture" id="AtlasTexture_b8pmf"]
atlas = ExtResource("2_4t74o") 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="PassageIndicator0Grad" instance=ExtResource("1_q65pt")]
[node name="ActiveTexture" parent="." index="0"] [node name="ActiveSprite" parent="." index="0"]
position = Vector2(32, 0) position = Vector2(32, 0)
texture = SubResource("AtlasTexture_f73ej") texture = SubResource("AtlasTexture_f73ej")
[node name="InactiveTexture" parent="." index="1"] [node name="InactiveSprite" parent="." index="1"]
position = Vector2(32, 0) position = Vector2(32, 0)
texture = SubResource("AtlasTexture_b8pmf") texture = SubResource("AtlasTexture_b8pmf")
@@ -5,16 +5,16 @@
[sub_resource type="AtlasTexture" id="AtlasTexture_qx624"] [sub_resource type="AtlasTexture" id="AtlasTexture_qx624"]
atlas = ExtResource("2_t7m7p") atlas = ExtResource("2_t7m7p")
region = Rect2(80, 0, 16, 16) region = Rect2(144, 48, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_t7m7p"] [sub_resource type="AtlasTexture" id="AtlasTexture_t7m7p"]
atlas = ExtResource("2_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="BossSectorIndicator" instance=ExtResource("1_qx624")]
[node name="ActiveTexture" parent="." index="0"] [node name="ActiveSprite" parent="." index="0"]
texture = SubResource("AtlasTexture_qx624") texture = SubResource("AtlasTexture_qx624")
[node name="InactiveTexture" parent="." index="1"] [node name="InactiveSprite" parent="." index="1"]
texture = SubResource("AtlasTexture_t7m7p") texture = SubResource("AtlasTexture_t7m7p")
@@ -5,16 +5,16 @@
[sub_resource type="AtlasTexture" id="AtlasTexture_1il3o"] [sub_resource type="AtlasTexture" id="AtlasTexture_1il3o"]
atlas = ExtResource("2_yiddm") atlas = ExtResource("2_yiddm")
region = Rect2(48, 0, 16, 16) region = Rect2(96, 48, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_yiddm"] [sub_resource type="AtlasTexture" id="AtlasTexture_yiddm"]
atlas = ExtResource("2_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="DebrisSectorIndicator" instance=ExtResource("1_1il3o")]
[node name="ActiveTexture" parent="." index="0"] [node name="ActiveSprite" parent="." index="0"]
texture = SubResource("AtlasTexture_1il3o") texture = SubResource("AtlasTexture_1il3o")
[node name="InactiveTexture" parent="." index="1"] [node name="InactiveSprite" parent="." index="1"]
texture = SubResource("AtlasTexture_yiddm") texture = SubResource("AtlasTexture_yiddm")
@@ -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")
@@ -5,16 +5,16 @@
[sub_resource type="AtlasTexture" id="AtlasTexture_5phms"] [sub_resource type="AtlasTexture" id="AtlasTexture_5phms"]
atlas = ExtResource("2_e1mcs") atlas = ExtResource("2_e1mcs")
region = Rect2(32, 0, 16, 16) region = Rect2(128, 48, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_e1mcs"] [sub_resource type="AtlasTexture" id="AtlasTexture_e1mcs"]
atlas = ExtResource("2_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="RepairSectorIndicator" instance=ExtResource("1_5phms")]
[node name="ActiveTexture" parent="." index="0"] [node name="ActiveSprite" parent="." index="0"]
texture = SubResource("AtlasTexture_5phms") texture = SubResource("AtlasTexture_5phms")
[node name="InactiveTexture" parent="." index="1"] [node name="InactiveSprite" parent="." index="1"]
texture = SubResource("AtlasTexture_e1mcs") texture = SubResource("AtlasTexture_e1mcs")
@@ -5,16 +5,16 @@
[sub_resource type="AtlasTexture" id="AtlasTexture_4uu3o"] [sub_resource type="AtlasTexture" id="AtlasTexture_4uu3o"]
atlas = ExtResource("2_j10ah") atlas = ExtResource("2_j10ah")
region = Rect2(16, 0, 16, 16) region = Rect2(112, 48, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_j10ah"] [sub_resource type="AtlasTexture" id="AtlasTexture_j10ah"]
atlas = ExtResource("2_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="ShopSectorIndicator" instance=ExtResource("1_4uu3o")]
[node name="ActiveTexture" parent="." index="0"] [node name="ActiveSprite" parent="." index="0"]
texture = SubResource("AtlasTexture_4uu3o") texture = SubResource("AtlasTexture_4uu3o")
[node name="InactiveTexture" parent="." index="1"] [node name="InactiveSprite" parent="." index="1"]
texture = SubResource("AtlasTexture_j10ah") texture = SubResource("AtlasTexture_j10ah")
@@ -5,16 +5,16 @@
[sub_resource type="AtlasTexture" id="AtlasTexture_glpdm"] [sub_resource type="AtlasTexture" id="AtlasTexture_glpdm"]
atlas = ExtResource("2_37krw") atlas = ExtResource("2_37krw")
region = Rect2(64, 0, 16, 16) region = Rect2(80, 48, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_37krw"] [sub_resource type="AtlasTexture" id="AtlasTexture_37krw"]
atlas = ExtResource("2_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="StartSectorIndicator" instance=ExtResource("1_glpdm")]
[node name="ActiveTexture" parent="." index="0"] [node name="ActiveSprite" parent="." index="0"]
texture = SubResource("AtlasTexture_glpdm") texture = SubResource("AtlasTexture_glpdm")
[node name="InactiveTexture" parent="." index="1"] [node name="InactiveSprite" parent="." index="1"]
texture = SubResource("AtlasTexture_37krw") texture = SubResource("AtlasTexture_37krw")
@@ -5,8 +5,16 @@ extends Node2D
const ANIMATION = "animation" const ANIMATION = "animation"
@onready var sprite : AnimatedSprite2D = $AnimatedSprite2D @onready var active_sprite : AnimatedSprite2D = $ActiveSprite
@onready var inactive_sprite : AnimatedSprite2D = $InactiveSprite
func _ready() -> void: 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
@@ -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="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"] [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") 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") 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") 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") atlas = ExtResource("2_485wc")
region = Rect2(224, 0, 32, 32) region = Rect2(96, 16, 32, 32)
[sub_resource type="SpriteFrames" id="SpriteFrames_5e44l"] [sub_resource type="SpriteFrames" id="SpriteFrames_5e44l"]
animations = [{ animations = [{
"frames": [{ "frames": [{
"duration": 25.0, "duration": 25.0,
"texture": SubResource("AtlasTexture_gx6w1") "texture": SubResource("AtlasTexture_eud2k")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_igqhl") "texture": SubResource("AtlasTexture_m1mdo")
}, { }, {
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_5vw2o") "texture": SubResource("AtlasTexture_84eqk")
}, { }, {
"duration": 1.0, "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, "loop": true,
"name": &"animation", "name": &"animation",
@@ -42,6 +78,10 @@ animations = [{
[node name="SelectedSectorIndicator" type="Node2D"] [node name="SelectedSectorIndicator" type="Node2D"]
script = ExtResource("1_06a3o") script = ExtResource("1_06a3o")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] [node name="ActiveSprite" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_5e44l") sprite_frames = SubResource("SpriteFrames_5e44l")
animation = &"animation" animation = &"animation"
[node name="InactiveSprite" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_ulua7")
animation = &"animation"
+1 -2
View File
@@ -6,7 +6,6 @@ signal activity_changed(is_active: bool)
enum SectorType { enum SectorType {
EmptySector,
ShopSector, ShopSector,
RepairSector, RepairSector,
DebrisSector, DebrisSector,
@@ -20,7 +19,7 @@ enum SectorType {
@export var seed_value : int = 0 @export var seed_value : int = 0
@export var type : SectorType = SectorType.EmptySector @export var type : SectorType = SectorType.DebrisSector
var is_active: bool = true: var is_active: bool = true:
+1 -1
View File
@@ -44,7 +44,7 @@ var passage_direction_rng : RandomNumberGenerator = RandomNumberGenerator.new()
@onready var passage_generator : PassageGenerator = $PassageGenerator @onready var passage_generator : PassageGenerator = $PassageGenerator
func generate(seed_value: int) -> AreaData: func generate(seed_value: int) -> AreaData:
local_seed_rng.seed = seed_value local_seed_rng.seed = seed_value
stage_seed_rng.seed = local_seed_rng.randi() stage_seed_rng.seed = local_seed_rng.randi()
passage_seed_rng.seed = local_seed_rng.randi() passage_seed_rng.seed = local_seed_rng.randi()
+3 -4
View File
@@ -3,10 +3,9 @@ extends Node
const CHANSES_BY_SECTOR_TYPE : Dictionary[SectorData.SectorType, int] = { const CHANSES_BY_SECTOR_TYPE : Dictionary[SectorData.SectorType, int] = {
SectorData.SectorType.EmptySector: 45, SectorData.SectorType.ShopSector: 40,
SectorData.SectorType.ShopSector: 30,
SectorData.SectorType.RepairSector: 20, 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: if threshold <= cumulative:
return type return type
return SectorData.SectorType.EmptySector return SectorData.SectorType.DebrisSector
BIN
View File
Binary file not shown.