From 6aaa64ad7ae94d938188029fb1c11d8a045407b9 Mon Sep 17 00:00:00 2001 From: Nikolay Fedorov Date: Wed, 22 Apr 2026 16:14:01 +0300 Subject: [PATCH] fix scale on hit the wall --- scripts/Enemy.gd | 13 ++++--------- scripts/Main.gd | 3 +++ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/scripts/Enemy.gd b/scripts/Enemy.gd index 37104ad..0a7e0f2 100644 --- a/scripts/Enemy.gd +++ b/scripts/Enemy.gd @@ -50,6 +50,7 @@ func setup(type: String, wave: int) -> void: health = 28 + wave * 4 score_value = 10 damage_to_player = 8 + enemy_level = 1 "bat": move_speed = 5.5 + wave * 0.15 health = 14 + wave * 2 @@ -59,6 +60,7 @@ func setup(type: String, wave: int) -> void: mesh_node.scale = Vector3(0.7, 0.7, 0.7) COLOR_CHASE = Color(0.6, 0.2, 0.8) mat.albedo_color = COLOR_CHASE + enemy_level = 2 "ogre": move_speed = 1.8 + wave * 0.08 health = 80 + wave * 12 @@ -68,6 +70,7 @@ func setup(type: String, wave: int) -> void: mesh_node.scale = Vector3(1.5, 1.5, 1.5) COLOR_CHASE = Color(0.3, 0.7, 0.3) mat.albedo_color = COLOR_CHASE + enemy_level = 3 func _physics_process(delta: float) -> void: match state: @@ -97,7 +100,6 @@ func _chase(delta: float) -> void: func _fly(delta: float) -> void: var speed_now := Vector2(fly_vel.x, fly_vel.z).length() - print_debug("speed is ", speed_now) velocity = fly_vel velocity.y = 0.0 move_and_slide() @@ -117,7 +119,7 @@ func _fly(delta: float) -> void: hit_wall = true break elif col3d.is_in_group("enemies") and col3d != self: - var other: Node = col3d + var other: Node = col3d if speed_now >= 3.0 and other.get("enemy_level") == enemy_level and other.get("is_upgrading") == false and is_upgrading == false: _start_merge(other) else: @@ -150,9 +152,6 @@ func receive_kick(direction: Vector3, force: float) -> void: fly_vel.y = 0.0 state = State.FLYING mat.albedo_color = COLOR_FLY - var tw := create_tween() - tw.tween_property(mesh_node, "scale:y", base_scale * 0.35, 0.06) - tw.tween_property(mesh_node, "scale:y", base_scale, 0.18) func _start_merge(other: Node) -> void: is_upgrading = true @@ -195,10 +194,6 @@ func _enter_stun() -> void: state = State.STUNNED stun_timer = stun_time mat.albedo_color = COLOR_STUN - var bs := base_scale - var tw := create_tween() - tw.tween_property(mesh_node, "scale", Vector3(bs * 1.6, bs * 0.25, bs * 1.6), 0.07) - tw.tween_property(mesh_node, "scale", Vector3(bs, bs, bs), 0.22) func _enter_chase() -> void: state = State.CHASING diff --git a/scripts/Main.gd b/scripts/Main.gd index 68bd41b..b371140 100644 --- a/scripts/Main.gd +++ b/scripts/Main.gd @@ -268,6 +268,9 @@ func _spawn_upgraded_enemy(pos: Vector3, type: String, level: int, w: int) -> Ch (col_shape.shape as BoxShape3D).size = old_size * s var color := Color(1.0, 1.0, 0.5) if level > 2 else Color(1.0, 0.9, 0.3) tw.tween_property(enemy.mat, "albedo_color", color, 0.25) + #var bs := scale + #tw.tween_property(enemy.mesh_node, "scale", Vector3(bs * 1.6, bs * 0.25, bs * 1.6), 0.07) + #tw.tween_property(enemy.mesh_node, "scale", Vector3(bs, bs, bs), 0.22) return enemy func _on_enemy_merged(_upgrade: bool) -> void: