Shotgun blast 2d not working

Godot Version

just updated to 4.5

Question

I have a top down game where the shotgun has a cone like blast but when i get farther form the global position 0,0 the wider the cone gets or something

code for the shooting

func projectile(player,spawn_end,aim_pos,projectile,bullet_spread,bullet_num):
	for i in bullet_num:
		var rand = aim_pos.rotated(randf_range(-bullet_spread,bullet_spread))
		var pro = projectile.instantiate()
		player.get_parent().add_child(pro)
		pro.global_position = spawn_end.global_position
		pro.global_rotation = spawn_end.global_rotation
		pro.direction = pro.global_position.direction_to(rand).normalized()

code for shotgun without reloading


@onready var player = $"../../.."
@onready var gunend = $gunend
@onready var max_range = $max_range

@export var bullet : PackedScene
@export var mag_size = 1
@export var max_ammmo = 1
@export var bullet_num = 1
@onready var cur_mag = mag_size
@export var bullet_spread : float
@export var reload_time = 1

func _physics_process(delta):
	if Input.is_action_just_pressed("shot"):
		if self.visible==true:
			if cur_mag>0:
		Global.projectile(player,gunend,max_range.global_position,bullet,bullet_spread,bullet_num)

bullet code

var direction: Vector2
const speed = 5

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _ready():
	add_to_group("hurts")

func _process(delta):
	global_position += direction * speed