car_select.gd 552 B

123456789101112131415161718192021222324252627282930313233
  1. extends Control
  2. # Member variables
  3. var town = null
  4. func _back():
  5. town.queue_free()
  6. show()
  7. func _load_scene(car):
  8. var tt = load(car).instance()
  9. tt.set_name("car")
  10. town = load("res://truck_scene.scn").instance()
  11. town.get_node("instance_pos").add_child(tt)
  12. town.get_node("back").connect("pressed", self, "_back")
  13. get_parent().add_child(town)
  14. hide()
  15. func _on_van_1_pressed():
  16. _load_scene("res://car_base.scn")
  17. func _on_van_2_pressed():
  18. _load_scene("res://trailer_truck.scn")
  19. func _on_van_3_pressed():
  20. _load_scene("res://crane.scn")