mirror of
https://github.com/godotengine/godot.git
synced 2025-01-06 17:37:18 +08:00
8639cecf4c
The scripts were streamlined using more or less the following conventions: - space after a comma in lists of arguments - space around weak operators (+, -), no space around strong operators (*, /) - space after a comment start (#) - removed trailing spaces or tabs, apart from those that delimit the function indentation level (those could be removed too but since they are added automatically by the editor when typing code, keeping them for now) - function blocks separate by two newlines The scene files were resaved with the (current) 2.0 format, and some scenes that were in XML format were converted to SCN, to be consistent across all demos.
33 lines
552 B
GDScript
33 lines
552 B
GDScript
|
|
extends Control
|
|
|
|
# member variables
|
|
var town = null
|
|
|
|
|
|
func _back():
|
|
town.queue_free()
|
|
show()
|
|
|
|
|
|
func _load_scene(car):
|
|
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")
|
|
get_parent().add_child(town)
|
|
hide()
|
|
|
|
|
|
func _on_van_1_pressed():
|
|
_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")
|