diff --git a/DungeonShooting_Godot/scene/Hall.tscn b/DungeonShooting_Godot/scene/Hall.tscn index 395632f..01826a7 100644 --- a/DungeonShooting_Godot/scene/Hall.tscn +++ b/DungeonShooting_Godot/scene/Hall.tscn @@ -1,6 +1,6 @@ -[gd_scene load_steps=6 format=3 uid="uid://c2hynqudkykxl"] +[gd_scene load_steps=10 format=3 uid="uid://c2hynqudkykxl"] -[ext_resource type="PackedScene" path="res://scene/Dungeon.tscn" id="1_31od0"] +[ext_resource type="PackedScene" uid="uid://bqf2vks5ggnsp" path="res://scene/Dungeon.tscn" id="1_31od0"] [ext_resource type="Script" path="res://src/game/hall/Hall.cs" id="2_43fdu"] [ext_resource type="Texture2D" uid="uid://b2j5mkqm3uv6w" path="res://resource/sprite/hall/HallBg.png" id="3_p8v6p"] [ext_resource type="Script" path="res://src/game/hall/DungeonEntrance.cs" id="3_t3my6"] @@ -8,15 +8,30 @@ [sub_resource type="RectangleShape2D" id="RectangleShape2D_ru8u4"] size = Vector2(66, 32) -[node name="Hall" node_paths=PackedStringArray("BirthMark") instance=ExtResource("1_31od0")] +[sub_resource type="RectangleShape2D" id="RectangleShape2D_l0mok"] +size = Vector2(91, 434) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ch1xw"] +size = Vector2(1024.5, 65.5) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_ea4u5"] +size = Vector2(448, 110) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_o0n0h"] +size = Vector2(1023, 110) + +[node name="Hall" node_paths=PackedStringArray("BirthMark", "BgSprite") instance=ExtResource("1_31od0")] script = ExtResource("2_43fdu") BirthMark = NodePath("BirthMark") +BgSprite = NodePath("HallBg") +metadata/_edit_horizontal_guides_ = [666.0, -210.0] [node name="HallBg" type="Sprite2D" parent="." index="1"] texture = ExtResource("3_p8v6p") +centered = false [node name="DungeonEntrance" type="Area2D" parent="." index="2"] -position = Vector2(27, -18) +position = Vector2(537, 209) collision_layer = 0 collision_mask = 8 monitorable = false @@ -26,4 +41,31 @@ shape = SubResource("RectangleShape2D_ru8u4") [node name="BirthMark" type="Marker2D" parent="." index="3"] -position = Vector2(-368, 88) +position = Vector2(140, 315) + +[node name="PointLight2D" type="PointLight2D" parent="." index="4"] +position = Vector2(138, 306) +texture_scale = 3.11 + +[node name="StaticBody2D" type="StaticBody2D" parent="." index="5"] +collision_mask = 0 + +[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D" index="0"] +position = Vector2(-47, 296) +shape = SubResource("RectangleShape2D_l0mok") + +[node name="CollisionShape2D5" type="CollisionShape2D" parent="StaticBody2D" index="1"] +position = Vector2(1070, 306) +shape = SubResource("RectangleShape2D_l0mok") + +[node name="CollisionShape2D2" type="CollisionShape2D" parent="StaticBody2D" index="2"] +position = Vector2(511.75, 481.25) +shape = SubResource("RectangleShape2D_ch1xw") + +[node name="CollisionShape2D3" type="CollisionShape2D" parent="StaticBody2D" index="3"] +position = Vector2(528, 393) +shape = SubResource("RectangleShape2D_ea4u5") + +[node name="CollisionShape2D4" type="CollisionShape2D" parent="StaticBody2D" index="4"] +position = Vector2(512.5, 148) +shape = SubResource("RectangleShape2D_o0n0h") diff --git a/DungeonShooting_Godot/src/game/World.cs b/DungeonShooting_Godot/src/game/World.cs index 6b0ff4d..aaa8d72 100644 --- a/DungeonShooting_Godot/src/game/World.cs +++ b/DungeonShooting_Godot/src/game/World.cs @@ -81,7 +81,6 @@ public override void _Ready() { - Color = Colors.Black; //TileRoot.YSortEnabled = false; NormalLayer = GetNode("TileRoot/NormalLayer"); YSortLayer = GetNode("TileRoot/YSortLayer"); diff --git a/DungeonShooting_Godot/src/game/hall/Hall.cs b/DungeonShooting_Godot/src/game/hall/Hall.cs index 836e9db..e8ffde4 100644 --- a/DungeonShooting_Godot/src/game/hall/Hall.cs +++ b/DungeonShooting_Godot/src/game/hall/Hall.cs @@ -11,15 +11,12 @@ /// [Export] public Marker2D BirthMark; + + [Export] + public Sprite2D BgSprite; /// /// 房间数据, 该数据时虚拟出来的, 并不是配置文件读取出来的 /// public RoomInfo RoomInfo { get; set; } - - public override void _Ready() - { - base._Ready(); - Color = Colors.White; - } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/room/Dungeon.cs b/DungeonShooting_Godot/src/game/room/Dungeon.cs index 8efe81a..fc52182 100644 --- a/DungeonShooting_Godot/src/game/room/Dungeon.cs +++ b/DungeonShooting_Godot/src/game/room/Dungeon.cs @@ -1,9 +1,17 @@ +using Godot; + /// /// 地牢类 /// public partial class Dungeon : World { + public override void _Ready() + { + base._Ready(); + Color = Colors.Black; + } + /// /// 初始化 TileMap 中的层级 /// diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs index a3226f9..20a6cd8 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -274,8 +274,8 @@ //创建房间数据 var roomInfo = new RoomInfo(0, DungeonRoomType.None, null); - roomInfo.Size = new Vector2I(50, 50); - roomInfo.Position = Vector2I.Zero; + roomInfo.Size = hall.BgSprite.Texture.GetSize().AsVector2I() / GameConfig.TileCellSize + new Vector2I(10, 10); + roomInfo.Position = hall.BgSprite.Position.AsVector2I() - new Vector2I(5, 5) * GameConfig.TileCellSize; hall.RoomInfo = roomInfo; yield return 0;