Need help with projectile position

izofra

Terrarian
Hello everyone again :)
I have trouble with my projectiles. I stuck arleady 2 days on this .
When i shoot from my gun its looks like projectile start his patch from me, not from gun.
How i can move projectile position when it start ? Closer to the barrel ?
 
Okey i found solvin by using alpha 255 and then set to 0 after 1f. But it still looks like projectile little bit closer to barrel from left side then right side. No idea how to fix that only for left side.
 
I wouldn't say you fixed the issue. The issue will remain either way.
For that, would be nice to know about the design of the weapon and projectile.
Maybe you can show a photo of the problem happening, with the projectile being shot from the gun.
 
okey its solved now. by this

public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Vector2 muzzleOffset = Vector2.Normalize(new Vector2(speedX, speedY)) * 25f;
if (Collision.CanHit(position, 0, 0, position + muzzleOffset, 0, 0))
{
position += muzzleOffset;
}
return true;
}
 
Back
Top Bottom