Enemy.gd 303 B

123456789101112131415
  1. extends RigidBody2D
  2. class_name Enemy
  3. export var min_speed = 150
  4. export var max_speed = 250
  5. var mob_types = ["walk", "swim", "fly"]
  6. func _ready():
  7. $AnimatedSprite.animation = mob_types[randi() % mob_types.size()]
  8. $AnimatedSprite.play()
  9. func _on_VisibilityNotifier2D_screen_exited():
  10. queue_free()