I need help centering my projectile

Tynitious

Terrarian
I've been working on a realm of the mag god version of terraria but i cant even make it past the first sword(T0ShortSword).
It's doing everything i want it to except it's offset to the right and it's bugging me, i've been at it for a week now and im going insane please help.



Here's what my code looks like...



using System;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;

namespace rotmg.Projectiles
{
public class T0swordprojectile : ModProjectile, ILocalizedModType, IModType
{
public string LocalizationCategory
{
get
{
return "Projectiles.Melee";
}
}

public override void SetDefaults()
{
base.Projectile.width = 10;
base.Projectile.height = 10;
base.Projectile.friendly = true;
base.Projectile.penetrate = 1;
base.Projectile.timeLeft = 35;
base.Projectile.DamageType = DamageClass.Melee;
Vector2 mousePosition = Main.MouseWorld;
}

public override void AI()
{
base.Projectile.rotation = (float)Math.Atan2(base.Projectile.velocity.Y, base.Projectile.velocity.X);
base.Projectile.velocity *= 1.03f;

int randomDust = Utils.SelectRandom<int>(Main.rand, new int[]
{
15,
107
});
}
}
}
 
Why are you using base? Also, the pivot of the projectile isn't at the center, instead is at the bottom right.
 
Back
Top Bottom