diff options
Diffstat (limited to 'godot/scenes/objects')
-rw-r--r-- | godot/scenes/objects/GoalTriggerBox.gd | 15 | ||||
-rw-r--r-- | godot/scenes/objects/GoalZone.tscn | 1 | ||||
-rw-r--r-- | godot/scenes/objects/Scoreboard.gd | 23 | ||||
-rw-r--r-- | godot/scenes/objects/Scoreboard.tscn | 239 |
4 files changed, 33 insertions, 245 deletions
diff --git a/godot/scenes/objects/GoalTriggerBox.gd b/godot/scenes/objects/GoalTriggerBox.gd index 9659520..208a2f3 100644 --- a/godot/scenes/objects/GoalTriggerBox.gd +++ b/godot/scenes/objects/GoalTriggerBox.gd @@ -1,22 +1,15 @@ extends Area -const Loader = preload("res://scenes/Game.gd") -var loader: Loader = null - -# Called when the node enters the scene tree for the first time. -func _ready(): - loader = get_node("/root/Game") +var loader -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass +func _on_GoalTriggerZone_tree_entered(): + loader = get_node("/root/Game") -func _on_Area_body_entered(body: RigidBody): +func _on_GoalTriggerZone_body_entered(body :RigidBody): # return when body is not a rigidbody if body == null: return loader.end_level() - diff --git a/godot/scenes/objects/GoalZone.tscn b/godot/scenes/objects/GoalZone.tscn index 79b8624..cc8c77d 100644 --- a/godot/scenes/objects/GoalZone.tscn +++ b/godot/scenes/objects/GoalZone.tscn @@ -3,6 +3,7 @@ [ext_resource path="res://scenes/objects/GoalTriggerBox.gd" type="Script" id=1] [sub_resource type="BoxShape" id=1] +extents = Vector3( 0.204243, 0.204176, 0.204328 ) [node name="GoalZone" type="Area"] script = ExtResource( 1 ) 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 |