Interior algorithm taking its shape
This commit is contained in:
35
proto3/godot/city/spaces_building_gen_2d.gd
Normal file
35
proto3/godot/city/spaces_building_gen_2d.gd
Normal file
@@ -0,0 +1,35 @@
|
||||
extends Node2D
|
||||
|
||||
var graph = {
|
||||
"entry": ["corridoor", "stairs"],
|
||||
"corridoor": ["corridoor", "flat-door"]
|
||||
}
|
||||
|
||||
var grid = []
|
||||
|
||||
var spaces = []
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
var space_color = []
|
||||
var xdim = 10
|
||||
var ydim = 10
|
||||
func _ready():
|
||||
$Camera2D.current = true
|
||||
grid.resize(10 * 10)
|
||||
for e in graph.keys():
|
||||
for k in [e] + graph[e]:
|
||||
if !k in spaces:
|
||||
spaces.push_back(k)
|
||||
space_color.push_back(Color(randf(), randf(), randf(), 1))
|
||||
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
# pass
|
||||
|
||||
func _draw():
|
||||
draw_rect(Rect2(-10, -10, 20, 20), Color(1, 0, 0, 1))
|
||||
Reference in New Issue
Block a user