Add UI support for addition dice, remove card once used

This commit is contained in:
CactiChameleon9 2022-07-16 16:12:32 +01:00
parent 638bb9439a
commit 6a6e74efa8
2 changed files with 22 additions and 8 deletions

View File

@ -15,7 +15,11 @@ const TYPE_COLORS = [
export (Resource) var card_info
var input_dice = []
var addition_dice_amount = card_info.addition_amount
var addition_dice_amount : int setget _set_addition_dice
func _set_addition_dice(new_amount):
$VBox/AutoGrid/InputDice0/Number.text = String(new_amount)
func _ready():
@ -34,6 +38,10 @@ func _ready():
# change the name and description
$VBox/Name.text = card_info.name
$VBox/Description.text = card_info.description
#maybe set the addition amount
if card_info.addition_dice:
self.addition_dice_amount = card_info.addition_amount
func dice_inputted(dice_number : int):
@ -70,7 +78,7 @@ func dice_inputted(dice_number : int):
# -- RUN DICE CHECKS --
if card_info.addition_dice:
addition_dice_amount -= dice_number
self.addition_dice_amount -= dice_number
input_dice.remove(0)
if addition_dice_amount > 0:
return
@ -135,4 +143,9 @@ func run_card():
emit_signal("return_dice", dice_number)
#clear the input dice
input_dice = []
#card is used, disappear
queue_free()

View File

@ -7,7 +7,7 @@
[ext_resource path="res://AutoGridContainer - Full Version/AutoGridContainer.tscn" type="PackedScene" id=5]
[ext_resource path="res://Assets/Metropolis-font/Metropolis-Medium.ttf" type="DynamicFontData" id=6]
[sub_resource type="StyleBoxFlat" id=6]
[sub_resource type="StyleBoxFlat" id=8]
bg_color = Color( 0.858824, 0.278431, 0.345098, 1 )
corner_radius_top_left = 20
corner_radius_top_right = 20
@ -45,7 +45,7 @@ card_info = ExtResource( 2 )
[node name="PanelContainer" type="PanelContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
custom_styles/panel = SubResource( 6 )
custom_styles/panel = SubResource( 8 )
[node name="VBox" type="VBoxContainer" parent="."]
anchor_right = 1.0
@ -59,14 +59,14 @@ margin_bottom = -10.0
margin_right = 263.0
margin_bottom = 31.0
custom_fonts/font = SubResource( 2 )
text = "The Card Name"
text = "Broadsword"
align = 1
autowrap = true
[node name="AutoGrid" parent="VBox" instance=ExtResource( 5 )]
margin_top = 35.0
margin_right = 263.0
margin_bottom = 259.0
margin_bottom = 256.0
[node name="InputDice0" type="TextureRect" parent="VBox/AutoGrid"]
margin_left = 9.0
@ -90,12 +90,13 @@ align = 1
valign = 1
[node name="Description" type="Label" parent="VBox"]
margin_top = 263.0
margin_top = 260.0
margin_right = 263.0
margin_bottom = 353.0
rect_min_size = Vector2( 0, 90 )
custom_fonts/font = SubResource( 5 )
text = "Description"
text = "Does damage equal to the sum of both dice to all enemies
Range: 2 spaces"
align = 1
valign = 1
autowrap = true