using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue { public class EclipseStealthBoom : ModProjectile, ILocalizedModType { public new string LocalizationCategory => "Projectiles.Rogue"; public const int Lifetime = 35; // 7 animation frames, 12 FPS public override void SetStaticDefaults() { Main.projFrames[Type] = 7; } public override void SetDefaults() { Projectile.width = Projectile.height = 102; Projectile.friendly = true; Projectile.ignoreWater = true; Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; Projectile.penetrate = -1; Projectile.timeLeft = Lifetime; Projectile.usesLocalNPCImmunity = true; Projectile.localNPCHitCooldown = -1; } public override void AI() { Projectile.frameCounter++; Projectile.frame = Projectile.frameCounter / 5; if (Projectile.frameCounter > Lifetime) Projectile.Kill(); } public override void PostDraw(Color lightColor) { Texture2D glow = ModContent.Request(Texture + "Glow").Value; Rectangle frame = glow.Frame(1, Main.projFrames[Type], 0, Projectile.frame); Main.EntitySpriteDraw(glow, Projectile.Center - Main.screenPosition, frame, Color.White, Projectile.rotation, frame.Size() * 0.5f, Projectile.scale, SpriteEffects.None); } } }