Enemy.gd 341 B

123456789101112131415161718
  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()
  11. func _on_start_game():
  12. queue_free()