placing brown bricks in codename routes is the most fun you can have while playing an app

This commit is contained in:
Zoe 2022-05-05 17:54:08 +02:00
parent 0b9ca2ebe5
commit f5975114a5
2 changed files with 11 additions and 10 deletions

View file

@ -2,9 +2,9 @@ extends Node
onready var server = $StateServer
export var xsize = 1048
export var ysize = 1048
export var zsize = 12
export var xsize = 512
export var ysize = 512
export var zsize = 16
var Tilemap = preload("res://world/Tilemap.tscn")
var tilemaps = []
@ -16,7 +16,8 @@ func respawn_tilemaps(amount: int):
tilemaps = []
for i in range(0, amount + 1):
var map = Tilemap.instance()
map.id = i
map.position.y -= i * map.cell_size.y
map.z_index = i
add_child(map)
tilemaps.push_back(map)
@ -24,7 +25,10 @@ func get_tile_at(pos: Vector3) -> String:
return server.get_tile_at(int(pos.x), int(pos.y), int(pos.z))
func update_tiles(tile_positions: PoolVector3Array):
print(get_tile_at(tile_positions[1]))
for tile in tile_positions:
tilemaps[tile.z].set_tile_graphics(Vector2(tile.x, tile.y),
get_tile_at(tile))
pass
func _on_StateServer_request_init():
respawn_tilemaps(zsize - 1)

View file

@ -1,7 +1,4 @@
extends TileMap
var id: int
func _ready():
pass # Replace with function body.
func set_tile_graphics(pos: Vector2, type: String):
set_cell(pos.x,pos.y,0,false,false,false,Vector2(1,2))