delete button and stuff
This commit is contained in:
parent
5509a5d488
commit
03d2923921
@ -1,6 +1,9 @@
|
|||||||
extends VBoxContainer
|
extends VBoxContainer
|
||||||
|
|
||||||
|
|
||||||
|
onready var delete = get_node("Delete")
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
func _ready():
|
func _ready():
|
||||||
for entry in BodyPartLoader.bodyparts:
|
for entry in BodyPartLoader.bodyparts:
|
||||||
@ -8,7 +11,8 @@ func _ready():
|
|||||||
button.text = entry
|
button.text = entry
|
||||||
add_child(button)
|
add_child(button)
|
||||||
button.connect("pressed", get_parent().get_parent().get_parent(), "body_part_chosen", [button.text])
|
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):
|
func button_pressed(params):
|
||||||
emit_signal("choose_bodypart", params[0])
|
emit_signal("choose_bodypart", params[0])
|
||||||
|
@ -32,6 +32,17 @@ margin_bottom = 600.0
|
|||||||
rect_min_size = Vector2( 300, 500 )
|
rect_min_size = Vector2( 300, 500 )
|
||||||
script = ExtResource( 3 )
|
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"]
|
[node name="ViewportContainer" type="ViewportContainer" parent="GUI/HBoxC"]
|
||||||
margin_left = 304.0
|
margin_left = 304.0
|
||||||
margin_right = 1024.0
|
margin_right = 1024.0
|
||||||
@ -55,5 +66,8 @@ collide_with_areas = true
|
|||||||
collide_with_bodies = false
|
collide_with_bodies = false
|
||||||
|
|
||||||
[node name="Torso" parent="." instance=ExtResource( 1 )]
|
[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"]
|
||||||
|
|
||||||
|
[editable path="Torso/FrontLeft"]
|
||||||
|
@ -87,9 +87,21 @@ func _input(event):
|
|||||||
|
|
||||||
|
|
||||||
func body_part_chosen(params):
|
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):
|
func make_it_shine(highlight : bool):
|
||||||
if _attachment_point != null:
|
if _attachment_point != null:
|
||||||
_attachment_point.get_node("OmniLight").visible = highlight
|
_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()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,3 +24,5 @@ omni_range = 1.8
|
|||||||
[node name="CollisionShape" type="CollisionShape" parent="Area"]
|
[node name="CollisionShape" type="CollisionShape" parent="Area"]
|
||||||
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0 )
|
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0 )
|
||||||
shape = SubResource( 2 )
|
shape = SubResource( 2 )
|
||||||
|
|
||||||
|
[node name="Limb" type="Spatial" parent="."]
|
||||||
|
@ -4,7 +4,7 @@ class_name BodyPart
|
|||||||
# Must be the direct child of an AttachmentPoint of the BodyBase
|
# 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")
|
onready var physics_shape = get_node("PartCollider")
|
||||||
|
|
||||||
export(int) var key
|
export(int) var key
|
||||||
|
Loading…
x
Reference in New Issue
Block a user