delete button and stuff

This commit is contained in:
Ententerminator committed 2020-02-01 15:47:56 +01:00
1 parent 5509a5d488
commit 03d2923921
5 files changed
+35 -3

No files matched your search

+5 -1
View File
@@ -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])
+14
View File
@@ -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"]
+13 -1
View File
@@ -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()