Guest User

Follow

a guest
Oct 20th, 2023
2,344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. extends State
  2.  
  3. func enter():
  4. super.enter()
  5. owner.set_physics_process(true)
  6. animation_player.play("idle")
  7.  
  8. func exit():
  9. super.exit()
  10. owner.set_physics_process(false)
  11.  
  12. func transition():
  13. var distance = owner.direction.length()
  14.  
  15. if distance < 30:
  16. get_parent().change_state("MeleeAttack")
  17. elif distance > 130:
  18. var chance = randi() % 2
  19. match chance:
  20. 0:
  21. get_parent().change_state("HomingMissile")
  22. 1:
  23. get_parent().change_state("LaserBeam")
  24.  
Advertisement
Add Comment
Please, Sign In to add comment