SteakBites
Terrarian
I'm trying to make a weapon that acts similarly to the starlight, the problem I'm having is the texture having backswing like a spear
how can I get rid of it
following is the code for the projectile, where I am to assume the problem lies
how can I get rid of it
following is the code for the projectile, where I am to assume the problem lies
Code:
using Terraria.ID;
using Terraria;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using System;
namespace MonsoonSais.Projectiles
{
public class DystopiaProjectile : ModProjectile
{
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Dystopia Projectile");
}
public override void SetDefaults()
{
Projectile.DamageType = DamageClass.Melee;
Projectile.scale = 1.0f;
Projectile.penetrate = -1;
Projectile.aiStyle = 19;
Projectile.width = 32;
Projectile.height = 32;
Projectile.friendly = true;
Projectile.hostile = false;
Projectile.timeLeft = 600;
Projectile.light = 0.25f;
Projectile.ignoreWater = false;
Projectile.tileCollide = false;
Projectile.ownerHitCheck = true;
Projectile.hide = true;
}
public float movementFactor
{
get => Projectile.ai[0] - 0.3f;
set => Projectile.ai[0] = value;
}
public override void AI()
{
Player player = Main.player[Projectile.owner];
Vector2 ownerMountedCenter = player.RotatedRelativePoint(player.MountedCenter, true);
Projectile.direction = player.direction;
player.heldProj = Projectile.whoAmI;
player.itemTime = player.itemAnimation;
Projectile.position.X = (ownerMountedCenter.X) - (float)Projectile.width / 2;
Projectile.position.Y = (ownerMountedCenter.Y) - (float)Projectile.height / 2;
Projectile.ai[1] += 1f;
if (!player.frozen)
{
if (movementFactor == 0)
{
movementFactor = 1.3f;
Projectile.netUpdate = true;
}
if (player.itemAnimation < player.itemAnimationMax/3)
{
movementFactor += 10f;
} else
{
movementFactor += 1.6f; //This is how fast the spear moves
}
}
Projectile.position += Projectile.velocity * movementFactor;
if (player.itemAnimation == 0)
{
Projectile.Kill();
}
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.ToRadians(135f);
if (Projectile.spriteDirection == 0)
{
Projectile.rotation -= MathHelper.ToRadians(90f);
}
}
}
}