extends Spatial


# Declare member variables here. Examples:
# var a = 2
# var b = "text"
#var tileGenScene = preload("res://TileGenerator.tscn")
#var Chunk = preload("res://chunk.tscn")

#var minlat = 20
#var maxlat = 26
#var minlon = 308
#var maxlon = 313
#var steplat = 1
#var steplon = 1

#var resolution = 512
var radius = 1737.4*1000
var startPos = Vector3(24,312,radius)

#var curlat = 0
#var curlon = 0

func _ready():
	Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
	get_node("Player").moveTo(startPos)
	
func _input(event):
	if event.is_action_pressed("ui_cancel"):
		Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
	if event.is_action_pressed("click"):
		if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE:
			Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
			get_tree().set_input_as_handled()

func _process(delta):
	pass
	#if curlat < maxlat*steplat:
	#	if curlon < maxlon*steplon:
	#		.get_node("Chunks").call_deferred("add_chunk", Vector2(curlat,curlon))
	#		curlon += steplon
	#	else:
	#		curlat +=steplat
	#		curlon = 0
	#		if curlat >= maxlat:
	#			print("loading complete")
"background_sky_rotation_degrees"


# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
#	pass

