freettrpg/scripts/mapscript.gd
2024-06-16 00:01:13 +02:00

17 lines
263 B
GDScript

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()
playerIndex += 1