From e730e2188eda08bf84fea7335dc2c0f3b5551509 Mon Sep 17 00:00:00 2001 From: altaf-creator Date: Sun, 14 Apr 2024 23:35:47 +0700 Subject: i want to sign off --- Levels/game.tscn | 8 ++++---- Reusable Scenes/number_node.tscn | 3 ++- Scripts/NumberNode.gd | 11 ++++++++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Levels/game.tscn b/Levels/game.tscn index 852378c..6e11d2a 100644 --- a/Levels/game.tscn +++ b/Levels/game.tscn @@ -59,8 +59,8 @@ player = NodePath("../Player") max_value = 100 min_size = 0.08 max_size = 0.2 -min_range = 160.0 -max_range = 350.0 +min_range = 180.0 +max_range = 370.0 [node name="Line2D" type="Line2D" parent="Player"] z_index = -1 @@ -120,8 +120,8 @@ player = NodePath("../AI") max_value = 100 min_size = 0.08 max_size = 0.2 -min_range = 160.0 -max_range = 340.0 +min_range = 180.0 +max_range = 370.0 [node name="ThisAIHasSkillIssue" type="ShapeCast2D" parent="AI"] modulate = Color(1, 0, 0, 1) diff --git a/Reusable Scenes/number_node.tscn b/Reusable Scenes/number_node.tscn index 37472df..ed5de58 100644 --- a/Reusable Scenes/number_node.tscn +++ b/Reusable Scenes/number_node.tscn @@ -5,7 +5,7 @@ [ext_resource type="Texture2D" uid="uid://4kqj3gk42j8w" path="res://Assets/Visuals/circle.png" id="3_bqdxd"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_ld6aj"] -size = Vector2(66, 66) +size = Vector2(44, 46) [sub_resource type="CircleShape2D" id="CircleShape2D_mh4p4"] radius = 29.41 @@ -27,6 +27,7 @@ sprite_modifier = NodePath("Sprite2D2") script = ExtResource("3_2viuw") [node name="CollisionShape2D" type="CollisionShape2D" parent="NumberArea2D"] +position = Vector2(1, -1) shape = SubResource("RectangleShape2D_ld6aj") [node name="ShapeCast2D" type="ShapeCast2D" parent="."] 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(): -- cgit v1.2.3