planet_switcher.gd 914 B

123456789101112131415161718192021222324252627282930
  1. extends Node
  2. # Declare member variables here. Examples:
  3. # var a = 2
  4. # var b = "text"
  5. var camera
  6. # Called when the node enters the scene tree for the first time.
  7. func _ready():
  8. camera = find_node("camera_mover")
  9. pass # Replace with function body.
  10. func _on_ItemList_item_selected(index):
  11. if index == 2:
  12. camera.get_parent().remove_child(camera)
  13. get_node("planet2/planet2").add_child(camera)
  14. get_node("the_real_camera").set_target(get_node("planet2/planet2/camera_mover/helper/camera"))
  15. if index == 1:
  16. camera.get_parent().remove_child(camera)
  17. get_node("planet/planet").add_child(camera)
  18. get_node("the_real_camera").set_target(get_node("planet/planet/camera_mover/helper/camera"))
  19. if index == 0:
  20. camera.get_parent().remove_child(camera)
  21. get_node("sun").add_child(camera)
  22. get_node("the_real_camera").set_target(get_node("sun/camera_mover/helper/camera"))
  23. pass # Replace with function body.