summaryrefslogtreecommitdiff
path: root/Scripts/NumberNode.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts/NumberNode.gd')
-rw-r--r--Scripts/NumberNode.gd11
1 files changed, 8 insertions, 3 deletions
diff --git a/Scripts/NumberNode.gd b/Scripts/NumberNode.gd
index 016a83c..b81481a 100644
--- a/Scripts/NumberNode.gd
+++ b/Scripts/NumberNode.gd
@@ -34,13 +34,15 @@ func _ready():
target_pos = position
update_visuals()
-func _process(_delta):
- sprite.scale = Vector2(size, size)
- shadow_sprite.scale = sprite.scale
+#func _process(_delta):
func _physics_process(_delta):
position = position.lerp(target_pos, 0.2)
+ if sqrt(((target_pos.x - position.x) * (target_pos.x - position.x) + (target_pos.y - position.y) * (target_pos.y - position.y))) < 15: # distance tolerance
+ sprite.scale = sprite.scale.lerp(Vector2(size, size), 0.2)
+ shadow_sprite.scale = sprite.scale
+
func join_from(node : NumberNode):
node.value += self.value
@@ -78,6 +80,9 @@ func update_visuals():
sprite_modifier.visible = true
if self.modifier_operation == Operations.NONE:
sprite_modifier.visible = false
+
+ if self.value < 0:
+ sprite.modulate.a = 0.5
## @deprecated
func softlock_check():