diff options
Diffstat (limited to 'Enemies/enemy.gd')
-rw-r--r-- | Enemies/enemy.gd | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Enemies/enemy.gd b/Enemies/enemy.gd index 5818fb4..ab1ceac 100644 --- a/Enemies/enemy.gd +++ b/Enemies/enemy.gd @@ -5,7 +5,7 @@ const SPEED = 30 func _ready() -> void: - set_physics_process(false) + process_mode = PROCESS_MODE_DISABLED func _physics_process(delta: float) -> void: @@ -20,4 +20,8 @@ func _physics_process(delta: float) -> void: func _on_visible_on_screen_notifier_2d_screen_entered() -> void: - set_physics_process(true) + process_mode = PROCESS_MODE_INHERIT + + +func _on_visible_on_screen_notifier_2d_screen_exited() -> void: + process_mode = PROCESS_MODE_DISABLED |