BooBuddies.gd 663 B

123456789101112131415161718
  1. extends Node2D
  2. @export_range(25, 180) var length := 80
  3. @export_enum("Clockwise", "C-Clockwise") var direction := 0
  4. @export_range(4, 12) var boo_amount := 10
  5. @export var spread_boos := false
  6. func _physics_process(delta: float) -> void:
  7. %RotationJoint.global_rotation_degrees = wrap(%RotationJoint.global_rotation_degrees + (45 * [1, -1][direction]) * delta, 0, 360)
  8. for i in $Boos.get_children():
  9. i.get_node("Sprite").scale.x = sign(get_tree().get_first_node_in_group("Players").global_position.x + 1 - i.global_position.x)
  10. func on_area_entered(area: Area2D) -> void:
  11. if area.owner is Player:
  12. area.owner.damage()
  13. func flag_die() -> void:
  14. queue_free()