21bcce37fa
Slight code fixups and changed some map stuff, Also added a stat viewer for the current player in the game itself.
37 lines
804 B
GDScript
37 lines
804 B
GDScript
extends Node2D
|
|
|
|
var playerAmount=2
|
|
var playerIndex=0
|
|
var objectName
|
|
|
|
func _ready():
|
|
$"../characterViewer".hideGet()
|
|
next()
|
|
|
|
func next():
|
|
if playerIndex >= playerAmount:
|
|
playerIndex = 0
|
|
objectName= "player%d" % playerIndex
|
|
print(objectName)
|
|
get_node(objectName).start()
|
|
playerIndex += 1
|
|
|
|
func stats():
|
|
visible = false
|
|
$"../characterViewer".visible = true
|
|
get_node(objectName).stop()
|
|
$"../back".disabled = false
|
|
$"../back".visible = true
|
|
$"../characterViewer".get_child(1).text = str(playerIndex-1)
|
|
$"../characterViewer".get_child(1).editable = false
|
|
$"../characterViewer"._on_button_pressed()
|
|
|
|
func restart():
|
|
visible = true
|
|
$"../characterViewer".visible = false
|
|
get_node(objectName).start()
|
|
$"../back".disabled = true
|
|
$"../back".visible = false
|
|
|
|
func _on_back_pressed():
|
|
restart()
|