wch
Terrarian
Yeah, ofc.I'm not exactly sure why you'd involve the velocity here(?).
We're talking about shoot intervalls here
That's weird, doesn't happen with me... Could you show me all your code (preferably in a spoiler, since it must be pretty long )
Code:
public class TonbogiriProjectile : ModProjectile
{
public override void SetDefaults()
{
projectile.name = "Tonbogiri Projectile";
projectile.width = 18;
projectile.height = 18;
projectile.scale = 1.3f;
projectile.friendly = true;
projectile.tileCollide = false;
projectile.ownerHitCheck = true;
projectile.penetrate = -1;
projectile.melee = true;
projectile.alpha = 0;
projectile.hide = true;
projectile.aiStyle = 19;
}
public override bool PreAI()
{
float protractSpeed = 1.5F;
float retractSpeed = 1.4F;
Vector2 vector21 = Main.player[projectile.owner].RotatedRelativePoint(Main.player[projectile.owner].MountedCenter, true);
projectile.direction = Main.player[projectile.owner].direction;
Main.player[projectile.owner].heldProj = projectile.whoAmI;
Main.player[projectile.owner].itemTime = Main.player[projectile.owner].itemAnimation;
projectile.position.X = vector21.X - (float)(projectile.width / 2);
projectile.position.Y = vector21.Y - (float)(projectile.height / 2);
if (!Main.player[projectile.owner].frozen)
{
if (projectile.ai[0] == 0f)
{
projectile.ai[0] = 3f;
projectile.netUpdate = true;
}
if (Main.player[projectile.owner].itemAnimation < Main.player[projectile.owner].itemAnimationMax / 3)
{
projectile.ai[0] -= retractSpeed;
}
else
{
projectile.ai[0] += protractSpeed;
}
}
projectile.position += projectile.velocity * projectile.ai[0];
if (Main.player[projectile.owner].itemAnimation == 0)
{
projectile.Kill();
}
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 2.355f;
if (projectile.spriteDirection == -1)
{
projectile.rotation -= 1.57f;
}
return false;
}
public override bool PreDraw(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, Microsoft.Xna.Framework.Color lightColor)
{
Vector2 zero = Vector2.Zero;
SpriteEffects effects1 = SpriteEffects.None;
if (projectile.spriteDirection == -1)
{
zero.X = (float)Main.projectileTexture[projectile.type].Width;
effects1 = SpriteEffects.FlipHorizontally;
}
Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + (float)(projectile.width / 2), projectile.position.Y - Main.screenPosition.Y + (float)(projectile.height / 2) + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), projectile.GetAlpha(lightColor), projectile.rotation, zero, projectile.scale, effects1, 0.0f);
return base.PreDraw(spriteBatch, lightColor);
}
}
}