mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
Fixed room spawn offsets
This commit is contained in:
parent
c928c86e6c
commit
33719a2da3
3 changed files with 16 additions and 9 deletions
|
|
@ -198,12 +198,8 @@ public partial class RogueliteRoomManager : Node2D
|
|||
|
||||
foreach (var direction in directions)
|
||||
{
|
||||
// var randOffshootStartIndex = SpawnedRooms.Count(x =>
|
||||
// x.RoomResource.Type is RoomType.Regular &&
|
||||
// x.RoomResource.HasDoors(DoorDirections.West | DoorDirections.East));
|
||||
|
||||
//var offshootTypeToSpawn = shuffledOffshoots[currentOffshoot % shuffledOffshoots.Count()];
|
||||
|
||||
GD.Print($"Offshoot trying {direction}");
|
||||
|
||||
if (!offshootsQueue.TryDequeue(out var offshootTypeToSpawn))
|
||||
{
|
||||
GD.Print("Ran out of offshoot types");
|
||||
|
|
@ -222,6 +218,8 @@ public partial class RogueliteRoomManager : Node2D
|
|||
new Queue<RogueliteRoomResource>().EnqueueRange(MapTheme.Rooms
|
||||
.Where(x => x.Type == offshootTypeToSpawn).ToList());
|
||||
|
||||
GD.Print($"Trying to spawn {roomsInOffshot} rooms ending in {endRooms.Peek()}");
|
||||
|
||||
var res = SpawnOffshoot(lastRoom, direction, offshootTypeToSpawn, roomsInOffshot, offshootRoomsQueue, endRooms);
|
||||
|
||||
if (res)
|
||||
|
|
@ -342,6 +340,16 @@ public partial class RogueliteRoomManager : Node2D
|
|||
return null;
|
||||
}
|
||||
|
||||
// Shift position by the size
|
||||
var posToSpawn = direction switch
|
||||
{
|
||||
Direction.Up => nextPos - new Vector2I(0, roomToSpawn.Size.Y -1),
|
||||
Direction.Down => nextPos,
|
||||
Direction.Left => nextPos - new Vector2I(roomToSpawn.Size.X -1, 0),
|
||||
Direction.Right => nextPos,
|
||||
_ => nextPos
|
||||
};
|
||||
|
||||
var spawnedRoom = TrySpawnRoom(roomToSpawn, nextPos, direction);
|
||||
if (spawnedRoom is null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue