It would be really helpful is someone helps me since I've been looking through godot docs and tutorials on youtube for a few days and can;t find the solution

-Dijion Mustard Cat

ask again, i dont understand what you want

So basically I want to turn this array,
[1][C][C][C]
[C][C][3][C][C]
[C]
[C][C] [2]
[C][C][C]
into real rooms inside of the game that uses a tilemap.

    DijionMustardCat still an open ended question.. put the tiles in the array and you done?

    DijionMustardCat
    [1][C][C][C]
    [C][C][3][C][C]
    [C]
    [C][C] [2]
    [C][C][C]

    In what way is this representing an array?

      xyz i assume columns and rows represent tile maps (dungeons)
      EDIT:
      I meant the other way around.. brain fart

      Yea, basically what kuligs2 just said

      • xyz replied to this.

        I mean how do I make each room have certain characteristics since right now it only is 1 integer so I don't know how to give it attributes like which side has a door or what type of room it is.

        DijionMustardCat Yea, basically what kuligs2 just said

        Arrays in GDScript don't have rows and columns. An array is a linear list of items. What you posted doesn't look like an array. If you have an array - print it directly and post that, so we can know what we're dealing with here.

        Manually make a [1] room, a [2] room, a [3] room and a [C] room.

        Observe what they have in common and how they differ, and generalize the procedure so that you can automate it based on what's inside the array.

        when I print it out I get this image of in my editor

        • xyz replied to this.

          (there are no values for the [thing printed out] on the left of the place where it is cut off

          i followed a tutorial by Thomas Yanzuella (idk if I wrote it right)

          here's the code:
          extends Node2D

          @export var _dimensions : Vector2i = Vector2i(7, 5)
          @export var _start : Vector2i = Vector2i(-1, 0)
          @export var _critical_path_length : int = 13
          @export var _branches : int = 3
          @export var _branch_length : Vector2i = Vector2i(1, 4)
          var _branch_candidates : Array[Vector2i]
          var dungeon : Array

          func _ready() -> void:
          _initialize_dungeon()
          _place_entrance()
          generate_path(start, _critical_path_length, "C")
          _generate_branches()
          _print_dungeon()

          func _initialize_dungeon() -> void:
          for x in _dimensions.x:
          dungeon.append([])
          for y in _dimensions.y:
          dungeon[x].append(0)

          func _place_entrance() -> void:
          if _start.x < 0 or _start.x >= _dimensions.x:
          _start.x = randi_range(0, _dimensions.x - 1)
          if _start.y < 0 or _start.y >= _dimensions.y:
          _start.y = randi_range(0, dimensions.y - 1)
          dungeon[
          start.x][_start.y] = "S"

          func _generate_path(from : Vector2i, length : int, marker : String) -> bool:
          if length == 0:
          return true
          var current : Vector2i = from
          var direction : Vector2i
          match randi_range(0, 3):
          0:
          direction = Vector2i.UP
          1:
          direction = Vector2i.RIGHT
          2:
          direction = Vector2i.DOWN
          3:
          direction = Vector2i.LEFT
          for i in 4:
          if (current.x + direction.x >= 0 and current.x + direction.x < _dimensions.x and
          current.y + direction.y >= 0 and current.y + direction.y < _dimensions.y and
          not dungeon[current.x + direction.x][current.y + direction.y]):
          current += direction
          dungeon[current.x][current.y] = marker
          if length > 1:
          _branch_candidates.append(current)
          if _generate_path(current, length - 1, marker):
          return true
          else:
          _branch_candidates.erase(current)
          dungeon[current.x][current.y] = 0
          current -= direction
          direction = Vector2(direction.y, -direction.x)
          return false

          func _generate_branches() -> void:
          var branches_created : int = 0
          var candidate : Vector2i
          while branches_created < _branches and _branch_candidates.size():
          candidate = _branch_candidates[randi_range(0, _branch_candidates.size() - 1)]
          if generate_path(candidate, randi_range(branch_length.x, _branch_length.y), str(branches_created + 1)):
          branches_created += 1
          else:
          _branch_candidates.erase(candidate)

          func print_dungeon() -> void:
          var dungeon_as_string : String = ""
          for y in range(
          dimensions.y - 1, -1, -1):
          for x in _dimensions.x:
          if dungeon[x][y]:
          dungeon_as_string += "[" + str(dungeon[x][y]) + "]"
          else:
          dungeon_as_string += " "
          dungeon_as_string += '\n'
          print(dungeon_as_string)