chunk displaying definitely doesn't work yet
This commit is contained in:
parent
7dc6a4c420
commit
abbaa6f450
16 changed files with 1170 additions and 113 deletions
|
@ -7,7 +7,7 @@
|
|||
# - etc.
|
||||
|
||||
class_name Main
|
||||
extends Node
|
||||
extends Node2D
|
||||
|
||||
signal set_camera_position(pos:Vector2)
|
||||
|
||||
|
@ -15,11 +15,12 @@ signal set_camera_position(pos:Vector2)
|
|||
var map_filenames:Array = [
|
||||
"res://maps/tampere_10x10km_1000px.png",
|
||||
"res://maps/tampere_10x10km_1024px.png",
|
||||
"res://maps/varkaus_256x256px_test.png"
|
||||
"res://maps/varkaus_256x256px_test.png",
|
||||
"res://maps/tampere_256px.png"
|
||||
]
|
||||
var map_filename:String = map_filenames[2]
|
||||
var map_filename:String = map_filenames[3]
|
||||
var _world_generator:WorldGenerator
|
||||
var _tilemap_generator:TileMapGenerator
|
||||
var _chunk_handler:ChunkHandler
|
||||
|
||||
|
||||
func _init():
|
||||
|
@ -33,25 +34,27 @@ func _init():
|
|||
func _ready():
|
||||
# create a new world and worldgenerator
|
||||
_world_generator = WorldGenerator.new()
|
||||
_tilemap_generator = TileMapGenerator.new()
|
||||
_chunk_handler = ChunkHandler.new()
|
||||
add_child(_chunk_handler)
|
||||
|
||||
var result = _world_generator.generate_world(map_filename)
|
||||
|
||||
# generate terrain. quit game if generation fails.
|
||||
if !_world_generator.generate_world(map_filename):
|
||||
push_error(Globals.ERROR_WHILE_GENERATING_MAP)
|
||||
quit_game()
|
||||
|
||||
if !_tilemap_generator:
|
||||
push_error(Globals.ERROR_MAKING_WORLD_INSTANCE)
|
||||
quit_game()
|
||||
if result:
|
||||
#_chunk_handler.start_handler()
|
||||
_chunk_handler.set_visible(true)
|
||||
_chunk_handler.add_chunk(0, 0)
|
||||
#_chunk_handler.show()
|
||||
#_chunk_handler.set_visible(true)
|
||||
print("main visible? ", is_visible_in_tree())
|
||||
|
||||
_tilemap_generator.start()
|
||||
_tilemap_generator.test_func()
|
||||
else:
|
||||
push_error("World generation failed :-(")
|
||||
|
||||
# center camera to world map
|
||||
emit_signal(
|
||||
"set_camera_position",
|
||||
Vector2(Globals.map_size.x / 2.0 * Globals.TILE_SIZE_X,
|
||||
Globals.map_size.y / 2.0 * Globals.TILE_SIZE_Y)
|
||||
Vector2(Globals.map_size / 2.0 * Globals.TILE_SIZE_X,
|
||||
Globals.map_size / 2.0 * Globals.TILE_SIZE_Y)
|
||||
)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue