BowserFlame.gd 639 B

1234567891011121314151617181920212223242526272829
  1. class_name BowserFlame
  2. extends Node2D
  3. @export_enum("Straight", "Aimed") var mode := 0
  4. var target_y := 0
  5. var direction := -1
  6. func _ready() -> void:
  7. pass
  8. func _physics_process(delta: float) -> void:
  9. movement(delta)
  10. func movement(delta: float) -> void:
  11. if mode == 1:
  12. global_position.y = move_toward(global_position.y, target_y, delta * 50)
  13. global_position.x += (100 * direction) * delta
  14. $Sprite.scale.x = direction
  15. func flag_die() -> void:
  16. queue_free()
  17. func on_area_entered(area: Area2D) -> void:
  18. if area.owner is Player:
  19. area.owner.damage()
  20. func play_sfx() -> void:
  21. AudioManager.play_sfx("bowser_flame", global_position)