Files
CalamityModPublic/Particles/FlameExplosion.cs
T
CongratsIsTrash 6d2dff85ba 1 - Revamp to free head movement
2 - Free head is once again immune to damage
3 - Gave free head the laser spread attack, which is followed by shooting lingering fire bolts
4 - Free head no longer passively fires fireballs, increased laser fire rate a bit
5 - Free head lasers no longer have differing speeds in Death Mode
6 - Removed body lasers after the head detaches

Fire bolt visuals are unfinished
2025-07-11 21:55:22 -04:00

58 lines
2.1 KiB
C#

using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
using static CalamityMod.CalamityUtils;
namespace CalamityMod.Particles
{
public class FlameExplosion : Particle
{
public override string Texture => "CalamityMod/Particles/FlameExplosion";
public override bool UseAdditiveBlend => true;
public override bool SetLifetime => true;
public override bool UseCustomDraw => true;
private float OriginalScale;
private float FinalScale;
private float baseOpacity;
private float opacity;
private Vector2 Squish;
private Color BaseColor;
public FlameExplosion(Vector2 position, Vector2 velocity, Color color, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, float opacity)
{
Position = position;
Velocity = velocity;
BaseColor = color;
OriginalScale = originalScale;
FinalScale = finalScale;
Scale = originalScale;
Lifetime = lifeTime;
Squish = squish;
Rotation = rotation;
baseOpacity = opacity;
}
public override void Update()
{
float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) });
Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress);
opacity = (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2) * baseOpacity;
Color = BaseColor * opacity;
Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f);
Velocity *= 0.95f;
}
public override void CustomDraw(SpriteBatch spriteBatch)
{
Texture2D tex = ModContent.Request<Texture2D>(Texture).Value;
spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish, SpriteEffects.None, 0);
}
}
}