22 lines
755 B
GDScript
22 lines
755 B
GDScript
extends Spatial
|
|
|
|
var players = {} # keys are String, values are Players
|
|
const Player = preload("res://Scenes/Player.tscn")
|
|
|
|
func init() -> void:
|
|
yield(get_tree(), "idle_frame")
|
|
get_parent().console_print('Starting arena inilisation...')
|
|
for player_id in get_parent().ids:
|
|
get_parent().console_print('Placing player with id: ' + String(player_id))
|
|
players[player_id] = Player.instance()
|
|
add_child(players[player_id])
|
|
players[player_id].translation = generate_translation()
|
|
players[player_id].rotation = generate_rotation()
|
|
rpc('place_player', player_id, players[player_id].translation, players[player_id].rotation)
|
|
|
|
func generate_translation() -> Vector3:
|
|
return Vector3(0,0,0)
|
|
|
|
func generate_rotation() -> Vector3:
|
|
return Vector3(0,0,1)
|