Main.gd 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. extends Spatial
  2. # Declare member variables here. Examples:
  3. # var a = 2
  4. # var b = "text"
  5. #var tileGenScene = preload("res://TileGenerator.tscn")
  6. var Chunk = preload("res://chunk.tscn")
  7. var minlat = -3
  8. var maxlat = 3
  9. var minlon = 0
  10. var maxlon = 6
  11. var curlat = 0
  12. var curlon = 0
  13. func _ready():
  14. Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
  15. curlat = minlat*30
  16. curlon = minlon*60
  17. func _input(event):
  18. if event.is_action_pressed("ui_cancel"):
  19. Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
  20. if event.is_action_pressed("click"):
  21. if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE:
  22. Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
  23. get_tree().set_input_as_handled()
  24. func _process(delta):
  25. if curlat < maxlat*30:
  26. if curlon < maxlon*60:
  27. var chunk = Chunk.instance()
  28. chunk.setParams(curlat,curlat+30,curlon,curlon+60,4)
  29. #moontile.scale=Vector3(1000,1000,1000)
  30. $Tiles.add_child(chunk)
  31. .get_node("UI/3").text="lastLatLon="+str(curlat)+":"+str(curlon)
  32. curlon += 60
  33. else:
  34. curlat +=30
  35. curlon = 0
  36. if curlat >= maxlat:
  37. print("loading complete")
  38. # Called every frame. 'delta' is the elapsed time since the previous frame.
  39. #func _process(delta):
  40. # pass