Implement a way to tell what move is being pressed

This commit is contained in:
CactiChameleon9 2022-03-24 16:45:53 +00:00
parent f187f690af
commit cb28c15a0e
2 changed files with 20 additions and 12 deletions

View File

@ -0,0 +1,6 @@
extends PopupPanel
func _move_selected(move_num: int) -> void:
print(move_num)
hide()

View File

@ -1,11 +1,13 @@
[gd_scene load_steps=2 format=2] [gd_scene load_steps=3 format=2]
[ext_resource path="res://src/assets/theme.theme" type="Theme" id=1] [ext_resource path="res://src/assets/theme.theme" type="Theme" id=1]
[ext_resource path="res://src/nodes/UI/UnitPopup.gd" type="Script" id=2]
[node name="PopupMenu" type="PopupPanel"] [node name="PopupMenu" type="PopupPanel"]
margin_right = 39.0 margin_right = 39.0
margin_bottom = 97.0 margin_bottom = 97.0
theme = ExtResource( 1 ) theme = ExtResource( 1 )
script = ExtResource( 2 )
[node name="VBoxContainer" type="VBoxContainer" parent="."] [node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.5 anchor_left = 0.5
@ -32,6 +34,12 @@ margin_bottom = 24.0
text = "Damage" text = "Damage"
align = 1 align = 1
[node name="Move0" type="Button" parent="VBoxContainer"]
margin_top = 76.0
margin_right = 32.0
margin_bottom = 84.0
text = "Move 0"
[node name="Move1" type="Button" parent="VBoxContainer"] [node name="Move1" type="Button" parent="VBoxContainer"]
margin_top = 28.0 margin_top = 28.0
margin_right = 32.0 margin_right = 32.0
@ -56,14 +64,8 @@ margin_right = 32.0
margin_bottom = 72.0 margin_bottom = 72.0
text = "Move 4" text = "Move 4"
[node name="Move5" type="Button" parent="VBoxContainer"] [connection signal="pressed" from="VBoxContainer/Move0" to="." method="_move_selected" binds= [ 0 ]]
margin_top = 76.0 [connection signal="pressed" from="VBoxContainer/Move1" to="." method="_move_selected" binds= [ 1 ]]
margin_right = 32.0 [connection signal="pressed" from="VBoxContainer/Move2" to="." method="_move_selected" binds= [ 2 ]]
margin_bottom = 84.0 [connection signal="pressed" from="VBoxContainer/Move3" to="." method="_move_selected" binds= [ 3 ]]
text = "Move 5" [connection signal="pressed" from="VBoxContainer/Move4" to="." method="_move_selected" binds= [ 4 ]]
[connection signal="button_down" from="VBoxContainer/Move1" to="." method="hide"]
[connection signal="button_down" from="VBoxContainer/Move2" to="." method="hide"]
[connection signal="button_down" from="VBoxContainer/Move3" to="." method="hide"]
[connection signal="button_down" from="VBoxContainer/Move4" to="." method="hide"]
[connection signal="button_down" from="VBoxContainer/Move5" to="." method="hide"]