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
+9 -14
View File
@@ -28,8 +28,7 @@ public class GoldenOrb : ModProjectile
{
if (Projectile.alpha > 70)
{
Projectile projectile = Projectile;
projectile.alpha -= 15;
Projectile.alpha -= 15;
if (Projectile.alpha < 70)
{
Projectile.alpha = 70;
@@ -47,7 +46,7 @@ public class GoldenOrb : ModProjectile
{
if (Main.npc[i].active && !Main.npc[i].dontTakeDamage && !Main.npc[i].friendly && Main.npc[i].lifeMax > 5)
{
Vector2 newMove = ((Entity)Main.npc[i]).Center - Projectile.Center;
Vector2 newMove = Main.npc[i].Center - Projectile.Center;
float distanceTo = (float)Math.Sqrt(newMove.X * newMove.X + newMove.Y * newMove.Y);
if (distanceTo < distance)
{
@@ -65,11 +64,10 @@ public class GoldenOrb : ModProjectile
}
if (Utils.NextFloat(Main.rand) < 0.1f && Projectile.alpha <= 100)
{
int dust1 = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<Dusts.MeatDust>(), 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.MeatDust>());
Main.dust[dust].scale = 0.9f;
Main.dust[dust].velocity *= 0.1f;
Main.dust[dust].noGravity = true;
}
AnimateProjectile();
}
@@ -85,14 +83,11 @@ public class GoldenOrb : ModProjectile
public void AnimateProjectile()
{
Projectile projectile = Projectile;
projectile.frameCounter++;
Projectile.frameCounter++;
if (Projectile.frameCounter >= 5)
{
Projectile projectile2 = Projectile;
projectile2.frame++;
Projectile projectile3 = Projectile;
projectile3.frame %= 3;
Projectile.frame++;
Projectile.frame %= 3;
Projectile.frameCounter = 0;
}
}