From c5a806528af8a4de5f903d26cd33edb7e0bb6597 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Sat, 13 Apr 2024 18:49:03 +0700 Subject: unfinished map generator --- Scripts/NumberNode.gd | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'Scripts/NumberNode.gd') 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 -- cgit v1.2.3