diff options
Diffstat (limited to 'Scripts/NumberNode.gd')
-rw-r--r-- | Scripts/NumberNode.gd | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Scripts/NumberNode.gd b/Scripts/NumberNode.gd index ca80530..41c5d4a 100644 --- a/Scripts/NumberNode.gd +++ b/Scripts/NumberNode.gd @@ -3,7 +3,7 @@ class_name NumberNode @export_group("Values") @export var value : int -@export var modifier : int +@export var modifier : float enum Operations { NONE, ADDITION, @@ -36,11 +36,11 @@ func join_from(node : NumberNode): node.value += self.value if self.modifier_operation == Operations.ADDITION: - node.value += self.modifier + node.value += roundi(self.modifier) if self.modifier_operation == Operations.SUBTRACTION: - node.value -= self.modifier + node.value -= roundi(self.modifier) if self.modifier_operation == Operations.MULTIPLICATION: - node.value = node.value * self.modifier + node.value = roundi(float(node.value) * self.modifier) if self.modifier_operation == Operations.DIVISION: node.value = roundi(float(node.value) / float(self.modifier)) @@ -55,12 +55,20 @@ func update_visuals(): if self.modifier_operation == Operations.ADDITION: label_modifier.text = "+ " + str(self.modifier) + sprite_modifier.visible = true + label_modifier.visible = true if self.modifier_operation == Operations.SUBTRACTION: label_modifier.text = "- " + str(self.modifier) + sprite_modifier.visible = true + label_modifier.visible = true if self.modifier_operation == Operations.MULTIPLICATION: label_modifier.text = "× " + str(self.modifier) + sprite_modifier.visible = true + label_modifier.visible = true if self.modifier_operation == Operations.DIVISION: label_modifier.text = "÷ " + str(self.modifier) + sprite_modifier.visible = true + label_modifier.visible = true if self.modifier_operation == Operations.NONE: sprite_modifier.visible = false label_modifier.visible = false |