diff options
author | Daniel Weipert <git@mail.dweipert.de> | 2024-05-03 09:32:22 +0200 |
---|---|---|
committer | Daniel Weipert <git@mail.dweipert.de> | 2024-05-03 09:32:22 +0200 |
commit | 516d22c1737a9c94026b5ff0c9856bc5549aa416 (patch) | |
tree | cd9ef3089d1c8bdfc440b5673f7ad0d0dce787a9 /Scenes/Entities/Enemies/Tree.gd | |
parent | d192b1546ab39180cdc28d2621c117539e3d26d6 (diff) |
update
Diffstat (limited to 'Scenes/Entities/Enemies/Tree.gd')
-rw-r--r-- | Scenes/Entities/Enemies/Tree.gd | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Scenes/Entities/Enemies/Tree.gd b/Scenes/Entities/Enemies/Tree.gd index db78788..5572e02 100644 --- a/Scenes/Entities/Enemies/Tree.gd +++ b/Scenes/Entities/Enemies/Tree.gd @@ -1,11 +1,17 @@ extends CharacterBody2D +@onready var component_collision: ComponentCollision = $Collision +@onready var component_movement: ComponentMovement = $Movement + + func _ready(): add_to_group("enemies") - get_node("Collision").init() + component_collision.init() + component_collision.collision_area.set_collision_mask_value(Utilities.Collision.Layer.EXPLOSION, false) + component_movement.process_mode = Node.PROCESS_MODE_DISABLED set_physics_process(false) $AnimatedSprite2D.play("spawn") $AnimatedSprite2D.stop() @@ -13,10 +19,12 @@ func _ready(): func _physics_process(delta): - get_node("Movement").physics_process(delta) + component_movement.physics_process(delta) func _on_detection_body_entered(_body): $AnimatedSprite2D.play("spawn") await $AnimatedSprite2D.animation_finished + component_collision.collision_area.set_collision_mask_value(Utilities.Collision.Layer.EXPLOSION, true) + component_movement.process_mode = Node.PROCESS_MODE_INHERIT set_physics_process(true) |