1234567891011121314151617181920212223242526272829303132 |
- class_name Chicken
- extends KinematicBody2D
- export var walk_linear_speed = 100
- export var run_boost = 4
- var velocity = Vector2.ZERO
- func attack(from: Vector2, angle: float):
- position = from
- velocity = Vector2(walk_linear_speed, 0).rotated(angle)
- $AnimatedSprite.play("walk")
- $AnimatedSprite.flip_h = velocity.x < 0.0
- func _physics_process(delta):
- move_and_collide(velocity * delta)
- func _on_VisibilityNotifier2D_screen_exited():
- die()
- func _on_Spawner_reset():
- die()
- func die():
- queue_free()
|