protoype world gen based on input image
This commit is contained in:
parent
acf1ed5423
commit
30ec55066b
11 changed files with 188 additions and 32 deletions
|
@ -8,12 +8,30 @@
|
|||
|
||||
extends Node
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
var world_map: TileMap
|
||||
|
||||
func _init():
|
||||
DisplayServer.window_set_size(
|
||||
Vector2i(Globals.DEFAULT_X_RES, Globals.DEFAULT_Y_RES)
|
||||
)
|
||||
)
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
generate_terrain()
|
||||
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta):
|
||||
pass
|
||||
|
||||
func generate_terrain():
|
||||
world_map = get_node("World")
|
||||
var image = Image.new()
|
||||
image.load("res://maps/tampere_10x10km_1000px.png")
|
||||
|
||||
for x in 1000:
|
||||
for y in 1000:
|
||||
# layer | position coords | tilemap id | coords of the tile at tilemap | alternative tile
|
||||
if image.get_pixel(x, y) == Color(1,1,1,1):
|
||||
world_map.set_cell(0, Vector2i(x, y), 2, Vector2i(0,0), 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue