-
Notifications
You must be signed in to change notification settings - Fork 0
/
Highscore.gd
29 lines (18 loc) · 992 Bytes
/
Highscore.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
extends Control
var names_array = ["Monika", "Pavel", "Petr", "Tomas", "Honza", "Lukas", "Monika", "Pavel", "Petr", "Tomas", "Honza", "Lukas"]
var score_array = [1000, 2000, 5000, 10000, 20000, 30000, 1000, 2000, 5000, 10000, 20000, 30000]
var subLabel = load("res://SubLabel.tscn")
func _ready():
var positionsContainer = $VBoxContainer/HighscoreScroll/HBoxContainer/Positions
var namesContainer = $VBoxContainer/HighscoreScroll/HBoxContainer/Names
var scoresContainer = $VBoxContainer/HighscoreScroll/HBoxContainer/Scores
for i in names_array.size():
var position = subLabel.instance()
position.text = str(i+1)
var label = subLabel.instance()
label.text = names_array[i]
var score = subLabel.instance()
score.text = str(score_array[i])
positionsContainer.add_child(position)
namesContainer.add_child(label)
scoresContainer.add_child(score)