mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 08:55:35 +00:00
Left paths
This commit is contained in:
parent
9331876637
commit
ee7ee8b955
18 changed files with 52 additions and 8 deletions
|
|
@ -10,4 +10,5 @@ ScenePath = &"uid://24wh7h2dbljf"
|
|||
Size = Vector2i(1, 1)
|
||||
DoorGridPositions = Array[Vector2i]([Vector2i(0, -1)])
|
||||
SpawnableEnemies = null
|
||||
DoorDirections = 4
|
||||
metadata/_custom_type_script = "uid://bl2ne8w12e3a"
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ ScenePath = &"uid://c3x64n451f3mk"
|
|||
Size = Vector2i(3, 2)
|
||||
DoorGridPositions = Array[Vector2i]([Vector2i(0, -1), Vector2i(0, 1), Vector2i(1, 0), Vector2i(-1, 0)])
|
||||
SpawnableEnemies = Array[Object]([ExtResource("1_ch23e"), ExtResource("2_l64su"), ExtResource("3_0b7uq"), ExtResource("4_iwrey")])
|
||||
DoorDirections = 30
|
||||
metadata/_custom_type_script = "uid://bl2ne8w12e3a"
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ ScenePath = &"uid://dngwjgs5bhnx7"
|
|||
Size = Vector2i(2, 2)
|
||||
DoorGridPositions = Array[Vector2i]([Vector2i(0, -1), Vector2i(0, 1), Vector2i(1, 0), Vector2i(-1, 0)])
|
||||
SpawnableEnemies = Array[Object]([ExtResource("1_772cf"), ExtResource("2_mabih"), ExtResource("3_lq7ck"), ExtResource("4_xqyuw")])
|
||||
DoorDirections = 30
|
||||
metadata/_custom_type_script = "uid://bl2ne8w12e3a"
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ ScenePath = &"uid://brytwc48xpj78"
|
|||
Size = Vector2i(1, 1)
|
||||
DoorGridPositions = Array[Vector2i]([Vector2i(0, 1)])
|
||||
SpawnableEnemies = Array[Object]([ExtResource("1_j16nh"), ExtResource("2_dneml"), ExtResource("3_m2ese"), ExtResource("4_fojtq")])
|
||||
DoorDirections = 2
|
||||
metadata/_custom_type_script = "uid://bl2ne8w12e3a"
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ ScenePath = &"uid://q3pvpdqv57p3"
|
|||
Size = Vector2i(1, 3)
|
||||
DoorGridPositions = Array[Vector2i]([Vector2i(0, -1), Vector2i(0, 1), Vector2i(1, 0), Vector2i(-1, 0)])
|
||||
SpawnableEnemies = Array[Object]([ExtResource("1_pepu3"), ExtResource("2_losk6"), ExtResource("3_kjjr4"), ExtResource("4_0g6c3")])
|
||||
DoorDirections = 6
|
||||
metadata/_custom_type_script = "uid://bl2ne8w12e3a"
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ ScenePath = &"uid://7svoss2nbksv"
|
|||
Size = Vector2i(1, 2)
|
||||
DoorGridPositions = Array[Vector2i]([Vector2i(0, -1), Vector2i(0, 1), Vector2i(1, 0), Vector2i(-1, 0)])
|
||||
SpawnableEnemies = Array[Object]([ExtResource("1_ly0m0"), ExtResource("2_bmbpy"), ExtResource("3_q8v3h"), ExtResource("4_ddqnp")])
|
||||
DoorDirections = 6
|
||||
metadata/_custom_type_script = "uid://bl2ne8w12e3a"
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ ScenePath = &"uid://ss7hm1utnvn1"
|
|||
Size = Vector2i(1, 3)
|
||||
DoorGridPositions = Array[Vector2i]([Vector2i(0, -1), Vector2i(0, 1), Vector2i(1, 0), Vector2i(-1, 0)])
|
||||
SpawnableEnemies = Array[Object]([ExtResource("1_yoxf3"), ExtResource("2_65es6"), ExtResource("3_7u7l8"), ExtResource("4_4dh4i")])
|
||||
DoorDirections = 30
|
||||
metadata/_custom_type_script = "uid://bl2ne8w12e3a"
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ ScenePath = &"uid://da7hmajaaiohm"
|
|||
Size = Vector2i(1, 1)
|
||||
DoorGridPositions = Array[Vector2i]([Vector2i(0, -1), Vector2i(0, 1), Vector2i(1, 0), Vector2i(-1, 0)])
|
||||
SpawnableEnemies = Array[Object]([ExtResource("1_qx515"), ExtResource("2_46i28"), ExtResource("3_g4rpe"), ExtResource("4_wvuta")])
|
||||
DoorDirections = 30
|
||||
metadata/_custom_type_script = "uid://bl2ne8w12e3a"
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ ScenePath = &"uid://dcxrdhq1yw5c7"
|
|||
Size = Vector2i(1, 1)
|
||||
DoorGridPositions = Array[Vector2i]([Vector2i(0, -1), Vector2i(0, 1), Vector2i(1, 0), Vector2i(-1, 0)])
|
||||
SpawnableEnemies = Array[Object]([ExtResource("1_1ns8k"), ExtResource("2_8dyfa"), ExtResource("3_3kq4c"), ExtResource("4_010mx")])
|
||||
DoorDirections = 30
|
||||
metadata/_custom_type_script = "uid://bl2ne8w12e3a"
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ ScenePath = &"uid://c36nvk7cw3emg"
|
|||
Size = Vector2i(3, 1)
|
||||
DoorGridPositions = Array[Vector2i]([Vector2i(0, -1), Vector2i(0, 1), Vector2i(1, 0), Vector2i(-1, 0)])
|
||||
SpawnableEnemies = Array[Object]([ExtResource("1_hqy32"), ExtResource("2_gpwow"), ExtResource("3_m1jol"), ExtResource("4_xpv8o")])
|
||||
DoorDirections = 30
|
||||
metadata/_custom_type_script = "uid://bl2ne8w12e3a"
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ ScenePath = &"uid://hmu4dw62c10t"
|
|||
Size = Vector2i(1, 2)
|
||||
DoorGridPositions = Array[Vector2i]([Vector2i(0, -1), Vector2i(0, 1), Vector2i(1, 0), Vector2i(-1, 0)])
|
||||
SpawnableEnemies = Array[Object]([ExtResource("1_qpcgt"), ExtResource("2_3a551"), ExtResource("3_v7kc3"), ExtResource("4_fwmn4")])
|
||||
DoorDirections = 30
|
||||
metadata/_custom_type_script = "uid://bl2ne8w12e3a"
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ y_sort_enabled = true
|
|||
script = ExtResource("4_jtlua")
|
||||
Rooms = Array[Object]([ExtResource("5_gwtv6"), ExtResource("6_gwtv6"), ExtResource("7_wbqvu"), ExtResource("8_3fyis"), ExtResource("9_go1yg"), ExtResource("5_pfafs"), ExtResource("11_68lig"), ExtResource("12_83bvc"), ExtResource("13_y651a"), ExtResource("14_vhvs2"), ExtResource("15_6gk3e")])
|
||||
DungeonLength = 4
|
||||
Seed = 1
|
||||
|
||||
[node name="CameraController" type="Camera2D" parent="."]
|
||||
process_mode = 1
|
||||
|
|
|
|||
|
|
@ -77,24 +77,24 @@ script = ExtResource("7_67kci")
|
|||
WallIndex = 2
|
||||
|
||||
[node name="South" type="Marker2D" parent="Doors"]
|
||||
position = Vector2(159.196, 149.348)
|
||||
position = Vector2(158, 319)
|
||||
script = ExtResource("7_67kci")
|
||||
Direction = 1
|
||||
|
||||
[node name="South2" type="Marker2D" parent="Doors"]
|
||||
position = Vector2(479.86, 149.81)
|
||||
position = Vector2(477, 319)
|
||||
script = ExtResource("7_67kci")
|
||||
Direction = 1
|
||||
WallIndex = 1
|
||||
|
||||
[node name="South3" type="Marker2D" parent="Doors"]
|
||||
position = Vector2(798.847, 148.522)
|
||||
position = Vector2(800, 317)
|
||||
script = ExtResource("7_67kci")
|
||||
Direction = 1
|
||||
WallIndex = 2
|
||||
|
||||
[node name="East" type="Marker2D" parent="Doors"]
|
||||
position = Vector2(312, 87)
|
||||
position = Vector2(951, 88)
|
||||
script = ExtResource("7_67kci")
|
||||
Direction = 2
|
||||
|
||||
|
|
@ -104,9 +104,11 @@ script = ExtResource("7_67kci")
|
|||
Direction = 3
|
||||
|
||||
[node name="NavigationRegion2D" type="NavigationRegion2D" parent="."]
|
||||
visible = false
|
||||
navigation_polygon = SubResource("NavigationPolygon_rlq0q")
|
||||
|
||||
[node name="PlayerEnterDetector" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ Direction = 1
|
|||
WallIndex = 2
|
||||
|
||||
[node name="East" type="Marker2D" parent="Doors"]
|
||||
position = Vector2(312, 87)
|
||||
position = Vector2(953, 91)
|
||||
script = ExtResource("7_d57gj")
|
||||
Direction = 2
|
||||
|
||||
|
|
@ -104,9 +104,11 @@ script = ExtResource("7_d57gj")
|
|||
Direction = 3
|
||||
|
||||
[node name="NavigationRegion2D" type="NavigationRegion2D" parent="."]
|
||||
visible = false
|
||||
navigation_polygon = SubResource("NavigationPolygon_rlq0q")
|
||||
|
||||
[node name="PlayerEnterDetector" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ position = Vector2(159, 23)
|
|||
script = ExtResource("7_vcw48")
|
||||
|
||||
[node name="South" type="Marker2D" parent="Doors"]
|
||||
position = Vector2(158.671, 315.53)
|
||||
position = Vector2(160, 476)
|
||||
script = ExtResource("7_vcw48")
|
||||
Direction = 1
|
||||
|
||||
|
|
@ -94,10 +94,12 @@ Direction = 3
|
|||
WallIndex = 1
|
||||
|
||||
[node name="NavigationRegion2D" type="NavigationRegion2D" parent="."]
|
||||
visible = false
|
||||
navigation_polygon = SubResource("NavigationPolygon_rlq0q")
|
||||
use_edge_connections = false
|
||||
|
||||
[node name="PlayerEnterDetector" type="Area2D" parent="."]
|
||||
visible = false
|
||||
collision_layer = 0
|
||||
collision_mask = 2
|
||||
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ public partial class RogueliteRoomManager : Node2D
|
|||
}
|
||||
|
||||
private IEnumerable<RogueliteRoomResource> StarterRooms => Rooms.Where(x => x.Type is RoomType.Starter);
|
||||
private IEnumerable<RogueliteRoomResource> RegularRooms => Rooms.Where(x => x.Type is RoomType.Regular);
|
||||
private IEnumerable<RogueliteRoomResource> RegularRooms => Rooms.Where(x => x.Type is RoomType.Regular && x.HasDoors(DoorDirections.North | DoorDirections.South));
|
||||
private IEnumerable<RogueliteRoomResource> OffshootRooms => Rooms.Where(x => x.Type is RoomType.Regular && x.HasDoors(DoorDirections.East | DoorDirections.West));
|
||||
|
||||
private IEnumerable<RogueliteRoomResource> BossRooms => Rooms.Where(x => x.Type is RoomType.Boss);
|
||||
|
||||
private List<Vector2I> _mainPath = new();
|
||||
|
|
@ -92,6 +94,8 @@ public partial class RogueliteRoomManager : Node2D
|
|||
|
||||
var randomRoomsList = RegularRooms.Shuffle(DungeonLength).ToList();
|
||||
|
||||
var randomOffshootRoomsList = OffshootRooms.Shuffle(MaxBranchLength).ToList();
|
||||
|
||||
var currentPos = origin;
|
||||
_connections.Add(new RoomConnection(origin, currentPos + new Vector2I(0, 1)));
|
||||
Vector2I nextPos;
|
||||
|
|
@ -152,12 +156,29 @@ public partial class RogueliteRoomManager : Node2D
|
|||
|
||||
// Spawn offshoot here
|
||||
|
||||
var offshootToSpawn = shuffledOffshoots[currentOffshoot % shuffledOffshoots.Count()];
|
||||
var offshootTypeToSpawn = shuffledOffshoots[currentOffshoot % shuffledOffshoots.Count()];
|
||||
|
||||
int roomsInOffshot = GD.RandRange(0, MaxBranchLength);
|
||||
|
||||
var leftPosition = spawnedRoom.GridPosition;
|
||||
|
||||
for (int j = 0; j < roomsInOffshot; j++)
|
||||
{
|
||||
var room = randomOffshootRoomsList.Shuffle().FirstOrDefault();
|
||||
|
||||
var offshootCoord = leftPosition - new Vector2I(room.Size.X, 0);
|
||||
|
||||
SpawnRoom(room, offshootCoord, out var spanwedOffshooot);
|
||||
|
||||
_connections.Add(new RoomConnection(leftPosition, offshootCoord + new Vector2I(room.Size.X -1, 0)));
|
||||
|
||||
leftPosition = offshootCoord;
|
||||
|
||||
// Get a random room with the required doors
|
||||
|
||||
|
||||
//var leftToRightRooms =
|
||||
|
||||
// Get a random door on right or left side
|
||||
// spawn
|
||||
// Add path
|
||||
|
|
|
|||
1
Scripts/Enums/OffshootType.cs.uid
Normal file
1
Scripts/Enums/OffshootType.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://1wkvva534glm
|
||||
|
|
@ -15,4 +15,8 @@ public partial class RogueliteRoomResource : Resource
|
|||
[Export] public Array<Vector2I> DoorGridPositions { get; set; } = [];
|
||||
|
||||
[Export] public Array<EnemyResource> SpawnableEnemies { get; set; }
|
||||
|
||||
[Export] public DoorDirections DoorDirections { get; set; }
|
||||
|
||||
public bool HasDoors(DoorDirections required) => (DoorDirections & required) == required;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue