extends Control

@onready var player_vars = get_node("/root/PlayerVariables")

var principal_face1 = preload("res://Principal/Face1.png")
var principal_face2 = preload("res://Principal/Face2.png")
var principal_face3 = preload("res://Principal/Face3.png")

var principal_num = 1
var principal_num_max = 4

@onready var principal_face = get_node("PrincipalPhoto")

func switch_principal_face():
	if principal_num == 1:
		principal_face.set_texture(principal_face1)
	
	if principal_num == 2:
		principal_face.set_texture(principal_face2)
	
	if principal_num == 3:
		principal_face.set_texture(principal_face3)

func _on_ChangeFace_pressed():
	if principal_num < principal_num_max:
		principal_num += 1
	
	if principal_num == principal_num_max:
		principal_num = 1
	
	$PrincipalNumLabel.text = str(principal_num)
	switch_principal_face()

# Called when the node enters the scene tree for the first time.
func _ready():
	$PrincipalNumLabel.text = str(principal_num)


# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
#	pass


func _on_SchoolNameOK_pressed():
	player_vars.school_name = $SchoolNameLine.text
