mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-04 17:25:55 +00:00
Cell ofssets
This commit is contained in:
parent
1e6c7e7f4e
commit
13ac8e4f2f
5 changed files with 136 additions and 17 deletions
17
Resources/RogueliteMaps/TestMapLongX3.tres
Normal file
17
Resources/RogueliteMaps/TestMapLongX3.tres
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[gd_resource type="Resource" script_class="RogueliteRoomResource" load_steps=6 format=3 uid="uid://cmgiqsmujujss"]
|
||||
|
||||
[ext_resource type="Resource" uid="uid://cocl3qontm3be" path="res://Resources/Enemies/Base_Fairy.tres" id="1_yoxf3"]
|
||||
[ext_resource type="Resource" uid="uid://cqfyuurvqb8m6" path="res://Resources/Enemies/Base_Fairy_Special.tres" id="2_65es6"]
|
||||
[ext_resource type="Resource" uid="uid://qbo6avc7x64b" path="res://Resources/Enemies/Fairy_Guard.tres" id="3_7u7l8"]
|
||||
[ext_resource type="Resource" uid="uid://cfdvg162u65sr" path="res://Resources/Enemies/Thermathron.tres" id="4_4dh4i"]
|
||||
[ext_resource type="Script" uid="uid://bl2ne8w12e3a" path="res://Scripts/Resources/Roguelite/RogueliteRoomResource.cs" id="5_ea8ub"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("5_ea8ub")
|
||||
RoomName = &"Test"
|
||||
Type = 1
|
||||
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")])
|
||||
metadata/_custom_type_script = "uid://bl2ne8w12e3a"
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=19 format=3 uid="uid://bf1kqr3o6r6d4"]
|
||||
[gd_scene load_steps=20 format=3 uid="uid://bf1kqr3o6r6d4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://doxmbokehw8ci" path="res://Scripts/GameManager.cs" id="1_wbqvu"]
|
||||
[ext_resource type="PackedScene" uid="uid://c4pr2707hbeph" path="res://Scenes/Actors/fsm_player.tscn" id="2_3fyis"]
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
[ext_resource type="PackedScene" uid="uid://dkwi1hu1bixoe" path="res://Scenes/HUD/HUD.tscn" id="10_6gk3e"]
|
||||
[ext_resource type="Script" uid="uid://bdshph801ac2i" path="res://Scenes/CameraTarget.gd" id="11_4gy5m"]
|
||||
[ext_resource type="Resource" uid="uid://cjtcksew0qy6d" path="res://Resources/RogueliteMaps/TestRGMapLarge.tres" id="11_68lig"]
|
||||
[ext_resource type="Resource" uid="uid://cmgiqsmujujss" path="res://Resources/RogueliteMaps/TestMapLongX3.tres" id="12_83bvc"]
|
||||
[ext_resource type="Script" uid="uid://cnkipcolyj61w" path="res://Scripts/AlarmManager.cs" id="12_eoca5"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3tyacxxw88lx" path="res://Scenes/Utils/StreamPlayerWithName.tscn" id="13_4n7t6"]
|
||||
[ext_resource type="Script" uid="uid://3v6q0p5krqn7" path="res://Scripts/UI/Minimap.cs" id="16_pfafs"]
|
||||
|
|
@ -31,8 +32,7 @@ SpawnMarkers = Dictionary[int, NodePath]({
|
|||
[node name="Maps" type="Node2D" parent="." groups=["navigation_polygon_source_geometry_group"]]
|
||||
process_mode = 1
|
||||
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")])
|
||||
DungeonLength = 8
|
||||
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")])
|
||||
|
||||
[node name="CameraController" type="Camera2D" parent="."]
|
||||
process_mode = 1
|
||||
|
|
|
|||
95
Scenes/Maps/RogueliteMaps/RgLongx3.tscn
Normal file
95
Scenes/Maps/RogueliteMaps/RgLongx3.tscn
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -125,7 +125,7 @@ public partial class RogueliteRoomManager : Node2D
|
|||
nextPos += new Vector2I(0, exit);
|
||||
|
||||
_connections.Add(new RoomConnection(currentPos, nextPos));
|
||||
|
||||
//+ new Vector2I(0, roomToSpawn.Size.Y -1)
|
||||
// Reset X offset
|
||||
//nextPos = new Vector2I(0, nextPos.Y);
|
||||
|
||||
|
|
|
|||
|
|
@ -97,28 +97,35 @@ public partial class Minimap : CanvasLayer
|
|||
|
||||
private void DrawRoomConnections(List<RoomConnection> connections, Vector2I minGrid, Vector2 baseOffset)
|
||||
{
|
||||
int spacing = (int)Separation;
|
||||
|
||||
foreach (var connection in connections)
|
||||
{
|
||||
// Skip if either room is missing
|
||||
if (!RoomGrid.ContainsKey(connection.From) || !RoomGrid.ContainsKey(connection.To))
|
||||
continue;
|
||||
|
||||
// // Calculate center positions of each room
|
||||
// Vector2 from = baseOffset + ((connection.From - minGrid) * (CellSize + (int)Separation)) + new Vector2(CellSize / 2f, CellSize / 2f);
|
||||
// Vector2 to = baseOffset + ((connection.To - minGrid) * (CellSize + (int)Separation)) + new Vector2(CellSize / 2f, Separation / 2f);
|
||||
|
||||
// Get relative positions of the two rooms
|
||||
Vector2 fromPos = baseOffset + ((connection.From - minGrid) * (CellSize + (int)Separation));
|
||||
Vector2 toPos = baseOffset + ((connection.To - minGrid) * (CellSize + (int)Separation));
|
||||
// Convert grid coordinates to local minimap grid (relative to min)
|
||||
Vector2I fromGrid = connection.From - minGrid;
|
||||
Vector2I toGrid = connection.To - minGrid;
|
||||
|
||||
// Determine direction between rooms (assumes adjacent rooms only)
|
||||
Vector2 delta = (toPos - fromPos).Normalized();
|
||||
// Center of the From cell in pixels
|
||||
Vector2 fromCenter = baseOffset
|
||||
+ fromGrid * (CellSize + spacing)
|
||||
+ new Vector2(CellSize / 2f, CellSize / 2f);
|
||||
|
||||
// Midpoint between rooms, where the gap is
|
||||
Vector2 gapCenter = (fromPos + toPos) * 0.5f + new Vector2(CellSize / 2f, CellSize / 2f);
|
||||
// Center of the To cell in pixels
|
||||
Vector2 toCenter = baseOffset
|
||||
+ toGrid * (CellSize + spacing)
|
||||
+ new Vector2(CellSize / 2f, CellSize / 2f);
|
||||
|
||||
// The gap center between rooms
|
||||
Vector2 gapCenter = (fromCenter + toCenter) * 0.5f;
|
||||
|
||||
// Short line inside the separation gap
|
||||
Vector2 delta = (toCenter - fromCenter).Normalized();
|
||||
Vector2 halfGap = delta * (spacing / 2f);
|
||||
|
||||
// Calculate endpoints of the connection line (centered in gap)
|
||||
Vector2 halfGap = delta * (Separation / 2f);
|
||||
Vector2 lineStart = gapCenter - halfGap;
|
||||
Vector2 lineEnd = gapCenter + halfGap;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue