Worked, thanksI use this:
the npc will shoot form the center and shoot at the player,
so use Projectile.NewProjectile(npc.Center, velocity, type, npc.damage, 2f); as your projectile.
void Shoot()
{
Vector2 velocity = player.Center - npc.Center; // Get the distance between target and npc.
float magnitude = Magnitude(velocity);
int type = 468;
if (magnitude > 0)
{
velocity *= 18 / magnitude;
}
else
{
velocity = new Vector2(0f, 5f);
}
Projectile.NewProjectile(npc.Center, velocity, type, npc.damage, 2f);
}
No problemWorked, thanks