Initial commit

This commit is contained in:
2026-01-21 23:51:53 +01:00
commit 60b208fee0
1703 changed files with 100223 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
extends Node3D
class_name LevelGenerator
var levelGrid: Array[Array]
@export var gridSize: int = 250
var spawnableRooms: Array[RoomData]
@export var testTexture: CompressedTexture2D
var roomLoader: RoomImageLoader = RoomImageLoader.new()
func _ready() -> void:
for x in gridSize:
var newRow: Array
levelGrid.push_back(newRow)
for y in gridSize:
var newCell := GridCell.new()
levelGrid[x].push_back(newCell)
addArrays2D(levelGrid,roomLoader.loadRoomData(testTexture.get_image()))
rotateArray2D(levelGrid,4)
printLevelGrid()
func addGridCells(cell1: GridCell,cell2: GridCell) -> GridCell:
var returnCell: GridCell = GridCell.new()
returnCell.spaceTaken = cell1.spaceTaken or cell2.spaceTaken
returnCell.door = cell2.door
returnCell.doorOrientation = cell2.doorOrientation
returnCell.biome = cell1.biome
return returnCell
func addArrays2D(array1: Array[Array], array2: Array[Array], arr2pos: Vector2i = Vector2i(0,0)) -> void:
if array1.size() < (arr2pos.x - 1) + array2.size(): return
if array1[arr2pos.y].size() < (arr2pos.y - 1) + array2[0].size(): return
for x in array2.size():
for y in array2[x].size():
array1[x+arr2pos.x][y+arr2pos.y] = addGridCells(array1[x+arr2pos.x][y+arr2pos.y],array2[x][y])
func rotateArray2D(array: Array[Array], numberOfRotationsBy90Degrees: int = 1) -> void:
var size: int = array.size()
var layerCount: int = size/2
for x in numberOfRotationsBy90Degrees%4:
for layer in layerCount:
var first: int = layer
var last: int = size - first - 1
for element in range(first, last):
var offset = element - first
var top = array[first][element]
var right = array[element][last]
var bot = array[last][last-offset]
var left = array[last-offset][first]
array[element][last] = top
array[last][last-offset] = right
array[last-offset][first] = bot
array[first][element] = left
func addObject(AddedObject:PackedScene, Parent: Node3D, Position: Vector3, Rotation: Vector3= Vector3(0,0,0)):
var obj = AddedObject.instantiate()
Parent.add_child(obj)
obj.position = Position
obj.rotation = Rotation
return obj
func printLevelGrid() -> void:
var debugCube: PackedScene = preload("res://test/debugCube.tscn")
for x in levelGrid.size():
for y in levelGrid[x].size():
if levelGrid[x][y].spaceTaken:
addObject(debugCube,self,Vector3(x,0,y))

View File

@@ -0,0 +1,66 @@
[gd_scene load_steps=2 format=3 uid="uid://c3cjtslhed2oc"]
[ext_resource type="Script" uid="uid://2niwcxdyq213" path="res://script/pausemenu.gd" id="1_qajsf"]
[node name="Pausemenu" type="Control"]
z_index = 4
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
focus_mode = 2
script = ExtResource("1_qajsf")
[node name="Menu" type="Panel" parent="."]
process_mode = 3
layout_mode = 0
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
focus_mode = 2
[node name="MarginContainer" type="MarginContainer" parent="Menu"]
layout_mode = 1
anchors_preset = 13
anchor_left = 0.5
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -127.0
offset_right = 127.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 50
theme_override_constants/margin_top = 50
theme_override_constants/margin_right = 50
theme_override_constants/margin_bottom = 50
[node name="VBoxCurrentLobby" type="VBoxContainer" parent="Menu/MarginContainer"]
custom_minimum_size = Vector2(500, 0)
layout_mode = 2
size_flags_horizontal = 3
[node name="CurrentLobbyLabel" type="Label" parent="Menu/MarginContainer/VBoxCurrentLobby"]
layout_mode = 2
text = "Current Lobby"
[node name="LobbyMemberList" type="ItemList" parent="Menu/MarginContainer/VBoxCurrentLobby"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
same_column_width = true
[node name="Disconnect" type="Button" parent="Menu/MarginContainer/VBoxCurrentLobby"]
process_mode = 3
layout_mode = 2
text = "Disconnect"
[node name="DebugModeBtn" type="Button" parent="Menu/MarginContainer/VBoxCurrentLobby"]
layout_mode = 2
text = "Debug Mode: false"
[connection signal="item_activated" from="Menu/MarginContainer/VBoxCurrentLobby/LobbyMemberList" to="." method="on_lobby_member_list_item_activated"]
[connection signal="pressed" from="Menu/MarginContainer/VBoxCurrentLobby/Disconnect" to="." method="on_disconnect_pressed"]
[connection signal="pressed" from="Menu/MarginContainer/VBoxCurrentLobby/DebugModeBtn" to="." method="_on_debug_mode_btn_pressed"]