123456789101112131415161718192021222324252627282930 |
- class_name Octo
- extends RigidBody2D
- export var min_speed = 150
- export var max_speed = 250
- var mob_types = ["walk", "swim", "fly"]
- func _ready():
- $AnimatedSprite.animation = mob_types[randi() % mob_types.size()]
- $AnimatedSprite.play()
- func attack(from: Vector2, angle: float):
- rotation = angle
- position = from
- linear_velocity = Vector2(rand_range(min_speed, max_speed), 0).rotated(angle)
- func _on_VisibilityNotifier2D_screen_exited():
- die()
- func _on_Spawner_reset():
- die()
- func die():
- queue_free()
|