From 37569906966cc4cd33278c5e2ad0aae9755aee33 Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sun, 17 Jul 2022 16:08:09 +0200 Subject: updated scoreboard to have only 3 holes and added sum at the end --- godot/scenes/objects/Scoreboard.gd | 23 ++-- godot/scenes/objects/Scoreboard.tscn | 239 +++-------------------------------- 2 files changed, 28 insertions(+), 234 deletions(-) (limited to 'godot/scenes/objects') diff --git a/godot/scenes/objects/Scoreboard.gd b/godot/scenes/objects/Scoreboard.gd index 0f6d32b..4c9ab2b 100644 --- a/godot/scenes/objects/Scoreboard.gd +++ b/godot/scenes/objects/Scoreboard.gd @@ -4,19 +4,18 @@ func update_values(values, pars): $Panel/GridContainer/Player0.text = "%d" % values[0] $Panel/GridContainer/Player1.text = "%d" % values[1] $Panel/GridContainer/Player2.text = "%d" % values[2] - $Panel/GridContainer/Player3.text = "%d" % values[3] - $Panel/GridContainer/Player4.text = "%d" % values[4] - $Panel/GridContainer/Player5.text = "%d" % values[5] - $Panel/GridContainer/Player6.text = "%d" % values[6] - $Panel/GridContainer/Player7.text = "%d" % values[7] - $Panel/GridContainer/Player8.text = "%d" % values[8] + + var sum = 0 + for i in values: + sum += i + $Panel/GridContainer/PlayerSum.text = "%d" % sum $Panel/GridContainer/Par0.text = "%d" % pars[0] $Panel/GridContainer/Par1.text = "%d" % pars[1] $Panel/GridContainer/Par2.text = "%d" % pars[2] - $Panel/GridContainer/Par3.text = "%d" % pars[3] - $Panel/GridContainer/Par4.text = "%d" % pars[4] - $Panel/GridContainer/Par5.text = "%d" % pars[5] - $Panel/GridContainer/Par6.text = "%d" % pars[6] - $Panel/GridContainer/Par7.text = "%d" % pars[7] - $Panel/GridContainer/Par8.text = "%d" % pars[8] + + sum = 0 + for i in pars: + sum += i + + $Panel/GridContainer/ParSum.text = "%d" % sum diff --git a/godot/scenes/objects/Scoreboard.tscn b/godot/scenes/objects/Scoreboard.tscn index ab9c887..070065a 100644 --- a/godot/scenes/objects/Scoreboard.tscn +++ b/godot/scenes/objects/Scoreboard.tscn @@ -23,10 +23,10 @@ anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 50.0 margin_top = 50.0 -columns = 10 +columns = 5 [node name="LabelHeader" type="Label" parent="Panel/GridContainer"] -margin_right = 159.0 +margin_right = 322.0 margin_bottom = 51.0 size_flags_horizontal = 3 size_flags_vertical = 1 @@ -38,125 +38,60 @@ valign = 3 autowrap = true [node name="Label" type="Label" parent="Panel/GridContainer"] -margin_left = 163.0 -margin_right = 322.0 -margin_bottom = 51.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "1" -align = 3 -valign = 3 -autowrap = true - -[node name="Label2" type="Label" parent="Panel/GridContainer"] margin_left = 326.0 -margin_right = 485.0 -margin_bottom = 51.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "2" -align = 3 -valign = 3 -autowrap = true - -[node name="Label3" type="Label" parent="Panel/GridContainer"] -margin_left = 489.0 margin_right = 648.0 margin_bottom = 51.0 size_flags_horizontal = 3 size_flags_vertical = 1 size_flags_stretch_ratio = 20.0 theme = ExtResource( 1 ) -text = "3" +text = "1" align = 3 valign = 3 autowrap = true -[node name="Label4" type="Label" parent="Panel/GridContainer"] +[node name="Label2" type="Label" parent="Panel/GridContainer"] margin_left = 652.0 -margin_right = 811.0 -margin_bottom = 51.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "4" -align = 3 -valign = 3 -autowrap = true - -[node name="Label5" type="Label" parent="Panel/GridContainer"] -margin_left = 815.0 margin_right = 974.0 margin_bottom = 51.0 size_flags_horizontal = 3 size_flags_vertical = 1 size_flags_stretch_ratio = 20.0 theme = ExtResource( 1 ) -text = "5" +text = "2" align = 3 valign = 3 autowrap = true -[node name="Label6" type="Label" parent="Panel/GridContainer"] +[node name="Label3" type="Label" parent="Panel/GridContainer"] margin_left = 978.0 -margin_right = 1137.0 -margin_bottom = 51.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "6" -align = 3 -valign = 3 -autowrap = true - -[node name="Label7" type="Label" parent="Panel/GridContainer"] -margin_left = 1141.0 margin_right = 1300.0 margin_bottom = 51.0 size_flags_horizontal = 3 size_flags_vertical = 1 size_flags_stretch_ratio = 20.0 theme = ExtResource( 1 ) -text = "7" +text = "3" align = 3 valign = 3 autowrap = true -[node name="Label8" type="Label" parent="Panel/GridContainer"] +[node name="Label4" type="Label" parent="Panel/GridContainer"] margin_left = 1304.0 -margin_right = 1463.0 -margin_bottom = 51.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "8" -align = 3 -valign = 3 -autowrap = true - -[node name="Label9" type="Label" parent="Panel/GridContainer"] -margin_left = 1467.0 margin_right = 1626.0 margin_bottom = 51.0 size_flags_horizontal = 3 size_flags_vertical = 1 size_flags_stretch_ratio = 20.0 theme = ExtResource( 1 ) -text = "9" +text = "Sum" align = 3 valign = 3 autowrap = true [node name="LabelHeader2" type="Label" parent="Panel/GridContainer"] margin_top = 55.0 -margin_right = 159.0 +margin_right = 322.0 margin_bottom = 106.0 size_flags_horizontal = 3 size_flags_vertical = 1 @@ -168,36 +103,8 @@ valign = 3 autowrap = true [node name="Par0" type="Label" parent="Panel/GridContainer"] -margin_left = 163.0 -margin_top = 55.0 -margin_right = 322.0 -margin_bottom = 106.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "0" -align = 3 -valign = 3 -autowrap = true - -[node name="Par1" type="Label" parent="Panel/GridContainer"] margin_left = 326.0 margin_top = 55.0 -margin_right = 485.0 -margin_bottom = 106.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "0" -align = 3 -valign = 3 -autowrap = true - -[node name="Par2" type="Label" parent="Panel/GridContainer"] -margin_left = 489.0 -margin_top = 55.0 margin_right = 648.0 margin_bottom = 106.0 size_flags_horizontal = 3 @@ -209,23 +116,9 @@ align = 3 valign = 3 autowrap = true -[node name="Par3" type="Label" parent="Panel/GridContainer"] +[node name="Par1" type="Label" parent="Panel/GridContainer"] margin_left = 652.0 margin_top = 55.0 -margin_right = 811.0 -margin_bottom = 106.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "0" -align = 3 -valign = 3 -autowrap = true - -[node name="Par4" type="Label" parent="Panel/GridContainer"] -margin_left = 815.0 -margin_top = 55.0 margin_right = 974.0 margin_bottom = 106.0 size_flags_horizontal = 3 @@ -237,23 +130,9 @@ align = 3 valign = 3 autowrap = true -[node name="Par5" type="Label" parent="Panel/GridContainer"] +[node name="Par2" type="Label" parent="Panel/GridContainer"] margin_left = 978.0 margin_top = 55.0 -margin_right = 1137.0 -margin_bottom = 106.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "0" -align = 3 -valign = 3 -autowrap = true - -[node name="Par6" type="Label" parent="Panel/GridContainer"] -margin_left = 1141.0 -margin_top = 55.0 margin_right = 1300.0 margin_bottom = 106.0 size_flags_horizontal = 3 @@ -265,23 +144,9 @@ align = 3 valign = 3 autowrap = true -[node name="Par7" type="Label" parent="Panel/GridContainer"] +[node name="ParSum" type="Label" parent="Panel/GridContainer"] margin_left = 1304.0 margin_top = 55.0 -margin_right = 1463.0 -margin_bottom = 106.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "0" -align = 3 -valign = 3 -autowrap = true - -[node name="Par8" type="Label" parent="Panel/GridContainer"] -margin_left = 1467.0 -margin_top = 55.0 margin_right = 1626.0 margin_bottom = 106.0 size_flags_horizontal = 3 @@ -295,7 +160,7 @@ autowrap = true [node name="LabelHeader3" type="Label" parent="Panel/GridContainer"] margin_top = 110.0 -margin_right = 159.0 +margin_right = 322.0 margin_bottom = 161.0 size_flags_horizontal = 3 size_flags_vertical = 1 @@ -307,36 +172,8 @@ valign = 3 autowrap = true [node name="Player0" type="Label" parent="Panel/GridContainer"] -margin_left = 163.0 -margin_top = 110.0 -margin_right = 322.0 -margin_bottom = 161.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "0" -align = 3 -valign = 3 -autowrap = true - -[node name="Player1" type="Label" parent="Panel/GridContainer"] margin_left = 326.0 margin_top = 110.0 -margin_right = 485.0 -margin_bottom = 161.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "0" -align = 3 -valign = 3 -autowrap = true - -[node name="Player2" type="Label" parent="Panel/GridContainer"] -margin_left = 489.0 -margin_top = 110.0 margin_right = 648.0 margin_bottom = 161.0 size_flags_horizontal = 3 @@ -348,23 +185,9 @@ align = 3 valign = 3 autowrap = true -[node name="Player3" type="Label" parent="Panel/GridContainer"] +[node name="Player1" type="Label" parent="Panel/GridContainer"] margin_left = 652.0 margin_top = 110.0 -margin_right = 811.0 -margin_bottom = 161.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "0" -align = 3 -valign = 3 -autowrap = true - -[node name="Player4" type="Label" parent="Panel/GridContainer"] -margin_left = 815.0 -margin_top = 110.0 margin_right = 974.0 margin_bottom = 161.0 size_flags_horizontal = 3 @@ -376,23 +199,9 @@ align = 3 valign = 3 autowrap = true -[node name="Player5" type="Label" parent="Panel/GridContainer"] +[node name="Player2" type="Label" parent="Panel/GridContainer"] margin_left = 978.0 margin_top = 110.0 -margin_right = 1137.0 -margin_bottom = 161.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "0" -align = 3 -valign = 3 -autowrap = true - -[node name="Player6" type="Label" parent="Panel/GridContainer"] -margin_left = 1141.0 -margin_top = 110.0 margin_right = 1300.0 margin_bottom = 161.0 size_flags_horizontal = 3 @@ -404,23 +213,9 @@ align = 3 valign = 3 autowrap = true -[node name="Player7" type="Label" parent="Panel/GridContainer"] +[node name="PlayerSum" type="Label" parent="Panel/GridContainer"] margin_left = 1304.0 margin_top = 110.0 -margin_right = 1463.0 -margin_bottom = 161.0 -size_flags_horizontal = 3 -size_flags_vertical = 1 -size_flags_stretch_ratio = 20.0 -theme = ExtResource( 1 ) -text = "0" -align = 3 -valign = 3 -autowrap = true - -[node name="Player8" type="Label" parent="Panel/GridContainer"] -margin_left = 1467.0 -margin_top = 110.0 margin_right = 1626.0 margin_bottom = 161.0 size_flags_horizontal = 3 -- cgit