freettrpg/scripts/mapscript.gd

19 lines
307 B
GDScript3
Raw Normal View History

extends Node2D
var playerAmount=2
var playerIndex=0
var objectName
func _ready():
next()
func next():
if playerIndex >= playerAmount:
playerIndex = 0
objectName= "player%d" % playerIndex
print(objectName)
get_node(objectName).start()
get_node(objectName).loadJSON(playerIndex)
playerIndex += 1