extends CharacterBody2D const SPEED = 30 func _ready() -> void: process_mode = PROCESS_MODE_DISABLED func _physics_process(delta: float) -> void: $AnimatedSprite2D.play() if not is_on_floor(): velocity += get_gravity() * delta velocity.x = -SPEED move_and_slide() func _on_visible_on_screen_notifier_2d_screen_entered() -> void: process_mode = PROCESS_MODE_INHERIT func _on_visible_on_screen_notifier_2d_screen_exited() -> void: process_mode = PROCESS_MODE_DISABLED