From 294f87adb4441ec25316601505ca1a7e97fa24c7 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Fri, 19 Jul 2024 14:24:09 +0200 Subject: update --- Scenes/Entities/Enemies/Snake.gd | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'Scenes/Entities/Enemies/Snake.gd') diff --git a/Scenes/Entities/Enemies/Snake.gd b/Scenes/Entities/Enemies/Snake.gd index a87ecf0..af09990 100644 --- a/Scenes/Entities/Enemies/Snake.gd +++ b/Scenes/Entities/Enemies/Snake.gd @@ -1,7 +1,7 @@ extends CharacterBody2D -@export var speed: float = 10 +@export var speed: float = 1 static var detected_bombs = [] var did_detect_bomb = false @@ -32,7 +32,9 @@ func _ready(): add_to_group("enemies") component_collision.init() + component_movement.SPEED = speed + component_movement.init() func _physics_process(delta): @@ -71,18 +73,19 @@ func _physics_process(delta): if $DetectionArea.get_overlapping_bodies().has(detected_bomb): _on_detection_area_body_entered(detected_bomb) elif did_detect_bomb: - component_movement.CURRENT_DIRECTION = detected_bomb_direction + component_movement.FIXED_DIRECTION = detected_bomb_direction - if not is_animating_state: - component_movement.physics_process(delta) + #if not is_animating_state: + #component_movement.physics_process(delta) func set_animating_state(state: bool): is_animating_state = state if is_animating_state: - component_movement.MovementTimer.stop() + component_movement.pause() + component_movement.FIXED_DIRECTION = null else: - component_movement.MovementTimer.start() + component_movement.unpause() func _on_detection_area_body_entered(_body): -- cgit v1.2.3