diff --git a/BodyConfig/LoadBodyParts.gd b/BodyConfig/LoadBodyParts.gd index 232e710..b54b8a7 100644 --- a/BodyConfig/LoadBodyParts.gd +++ b/BodyConfig/LoadBodyParts.gd @@ -1,6 +1,9 @@ extends VBoxContainer +onready var delete = get_node("Delete") + + # Called when the node enters the scene tree for the first time. func _ready(): for entry in BodyPartLoader.bodyparts: @@ -8,7 +11,8 @@ func _ready(): button.text = entry add_child(button) button.connect("pressed", get_parent().get_parent().get_parent(), "body_part_chosen", [button.text]) - + + delete.connect("pressed", get_parent().get_parent().get_parent(), "delete_body_part") func button_pressed(params): emit_signal("choose_bodypart", params[0]) diff --git a/BodyConfig/bodyBuilderMenu.tscn b/BodyConfig/bodyBuilderMenu.tscn index b0066b8..6dfdb6a 100644 --- a/BodyConfig/bodyBuilderMenu.tscn +++ b/BodyConfig/bodyBuilderMenu.tscn @@ -32,6 +32,17 @@ margin_bottom = 600.0 rect_min_size = Vector2( 300, 500 ) script = ExtResource( 3 ) +[node name="Start" type="Button" parent="GUI/HBoxC/VBoxC"] +margin_right = 300.0 +margin_bottom = 20.0 +text = "Start Game" + +[node name="Delete" type="Button" parent="GUI/HBoxC/VBoxC"] +margin_top = 24.0 +margin_right = 300.0 +margin_bottom = 44.0 +text = "Delete" + [node name="ViewportContainer" type="ViewportContainer" parent="GUI/HBoxC"] margin_left = 304.0 margin_right = 1024.0 @@ -55,5 +66,8 @@ collide_with_areas = true collide_with_bodies = false [node name="Torso" parent="." instance=ExtResource( 1 )] +[connection signal="pressed" from="GUI/HBoxC/VBoxC/Start" to="." method="_on_Button2_pressed"] [editable path="Torso"] + +[editable path="Torso/FrontLeft"] diff --git a/BodyConfig/bodyBuildingScript.gd b/BodyConfig/bodyBuildingScript.gd index e3e9c7a..9739736 100644 --- a/BodyConfig/bodyBuildingScript.gd +++ b/BodyConfig/bodyBuildingScript.gd @@ -87,9 +87,21 @@ func _input(event): func body_part_chosen(params): - _attachment_point.add_child(BodyPartLoader.bodyparts[params].instance()) + var limb = _attachment_point.get_node("Limb") + if limb != null: + limb.add_child(BodyPartLoader.bodyparts[params].instance()) func make_it_shine(highlight : bool): if _attachment_point != null: _attachment_point.get_node("OmniLight").visible = highlight + + +func delete_body_part(): + var body_part = _attachment_point.get_node("Limb").get_child(0) + if body_part != null: + body_part.queue_free() + + + + diff --git a/BodyParts/BodyBase/AttachmentPoint.tscn b/BodyParts/BodyBase/AttachmentPoint.tscn index 049c59b..a579df7 100644 --- a/BodyParts/BodyBase/AttachmentPoint.tscn +++ b/BodyParts/BodyBase/AttachmentPoint.tscn @@ -24,3 +24,5 @@ omni_range = 1.8 [node name="CollisionShape" type="CollisionShape" parent="Area"] transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0 ) shape = SubResource( 2 ) + +[node name="Limb" type="Spatial" parent="."] diff --git a/BodyParts/BodyPart.gd b/BodyParts/BodyPart.gd index 18f6034..64fc552 100644 --- a/BodyParts/BodyPart.gd +++ b/BodyParts/BodyPart.gd @@ -4,7 +4,7 @@ class_name BodyPart # Must be the direct child of an AttachmentPoint of the BodyBase -onready var base = get_parent().get_parent() +onready var base = get_parent().get_parent().get_parent() onready var physics_shape = get_node("PartCollider") export(int) var key