godot/demos/3d/truck_town/car_select.gd

33 lines
552 B
GDScript3
Raw Normal View History

2014-10-03 03:25:53 +00:00
extends Control
# Member variables
var town = null
2014-10-03 03:25:53 +00:00
func _back():
town.queue_free()
show()
func _load_scene(car):
2014-10-03 03:25:53 +00:00
var tt = load(car).instance()
tt.set_name("car")
town = load("res://truck_scene.scn").instance()
town.get_node("instance_pos").add_child(tt)
town.get_node("back").connect("pressed", self, "_back")
2014-10-03 03:25:53 +00:00
get_parent().add_child(town)
hide()
func _on_van_1_pressed():
2014-10-03 03:25:53 +00:00
_load_scene("res://car_base.scn")
func _on_van_2_pressed():
_load_scene("res://trailer_truck.scn")
func _on_van_3_pressed():
_load_scene("res://crane.scn")