Clean up all projectile code.

This commit is contained in:
Big Duckie
2022-07-05 22:32:27 -06:00
parent 2b34d060c5
commit 099f0a2e50
73 changed files with 651 additions and 840 deletions
+13 -20
View File
@@ -30,19 +30,17 @@ public class TheWhisperingIcicle : ModProjectile
{
if (Main.rand.NextBool(3))
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.CrystalDust2>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.CrystalDust2>());
Main.dust[dust].scale = 0.9f;
Main.dust[dust].velocity *= 0.1f;
Main.dust[dust].noGravity = true;
}
AnimateProjectile();
}
public override bool OnTileCollide(Vector2 oldVelocity)
{
Projectile projectile = Projectile;
projectile.penetrate--;
Projectile.penetrate--;
if (Projectile.penetrate <= 0)
{
Projectile.Kill();
@@ -58,8 +56,7 @@ public class TheWhisperingIcicle : ModProjectile
{
Projectile.velocity.Y = 0f - oldVelocity.Y;
}
Projectile projectile2 = Projectile;
projectile2.velocity *= 0.75f;
Projectile.velocity *= 0.75f;
SoundEngine.PlaySound(SoundID.Item27, Projectile.position);
}
return false;
@@ -69,11 +66,10 @@ public class TheWhisperingIcicle : ModProjectile
{
for (int i = 0; i < 5; i++)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.CrystalDust2>(), 0f, 0f, 0, default, 1f);
Main.dust[dust1].scale = 0.9f;
Dust obj = Main.dust[dust1];
obj.velocity *= 0.1f;
Main.dust[dust1].noGravity = true;
int dust = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.CrystalDust2>());
Main.dust[dust].scale = 0.9f;
Main.dust[dust].velocity *= 0.1f;
Main.dust[dust].noGravity = true;
}
SoundEngine.PlaySound(SoundID.Item27, Projectile.position);
}
@@ -90,14 +86,11 @@ public class TheWhisperingIcicle : ModProjectile
public void AnimateProjectile()
{
Projectile projectile = Projectile;
projectile.frameCounter++;
Projectile.frameCounter++;
if (Projectile.frameCounter >= 3)
{
Projectile projectile2 = Projectile;
projectile2.frame++;
Projectile projectile3 = Projectile;
projectile3.frame %= 16;
Projectile.frame++;
Projectile.frame %= 16;
Projectile.frameCounter = 0;
}
}