-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGame_Scene.gd
37 lines (32 loc) · 1.08 KB
/
Game_Scene.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
extends Spatial
# class member variables go here, for example:
# var a = 2
# var b = "textvar"
onready var autoload = get_node("/root/Autoload")
onready var camera_setup = get_node("CameraSetup")
onready var car = load("res://PlayerTrain.tscn")
var cars = []
func _ready():
# Called when the node is added to the scene for the first time.
# Initialization here
print("number of players is", autoload.player_count)
for x in range(2):
var new_car = car.instance()
new_car.set_name("Player" + String(x + 1))
print(new_car.name)
self.add_child(new_car)
new_car.global_transform.origin = Vector3(25, 2, -8 + (16*x))
new_car.set_rotation(Vector3 (0, deg2rad(-90), 0))
new_car.set_player_num(x+1)
var UIpath = null
if x == 0:
UIpath = get_node("CameraSetup/UI/Viewport1/Control")
elif x == 1:
UIpath = get_node("CameraSetup/UI/Viewport2/Control")
new_car.set_UIpath(UIpath)
cars.append(get_node("Player" + String(x + 1)))
camera_setup.setup_cameras(cars)
#func _process(delta):
# # Called every frame. Delta is time since last frame.
# # Update game logic here.
# pass