From 2ff95c0ae601b5e9fc9bfe32fed330a4a14e2699 Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Wed, 13 Jul 2022 00:20:41 +0200 Subject: [PATCH] Imrpoved skull particley --- Particles/DesertProwlerSkull.png | Bin 204 -> 297 bytes Particles/DesertProwlerSkullParticle.cs | 21 ++++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Particles/DesertProwlerSkull.png b/Particles/DesertProwlerSkull.png index 100d58f9aea6ae8bed4045150ed469d4bb48f290..b5b9d0fada9959fbae384de0dbdf58d01a2d3a67 100644 GIT binary patch literal 297 zcmV+^0oMMBP)Px#<4Ht8R7i=1){$Rub9;`72kaEs^ zOEi`CZuHNkU9`>+!YaO4vz)EZG89rKd^C=kN~`XGkdGr)NS~!`CHy7Xfe1JtzE;=0 zNku$f1O^j}dwY|r5>E{!wldLCC5q=daN+7+;>@LLD6zG&y)JJeMR|){nM#C9e;1f>GABJU{qg3m zc&1zW_Ias`emkn%%-F`6da@_Y@&Dy%Zv2y{arCa8)OgNia{3jq#xK|0zWlo+8QCKA zBs_BZ{Cn%dg;Q78e|dHEg!v^NBLTNq?hn&4-NYHnm35--y|V(kh{4m<&t;ucLK6UR C)lew_ diff --git a/Particles/DesertProwlerSkullParticle.cs b/Particles/DesertProwlerSkullParticle.cs index 2771858046..67a7da4384 100644 --- a/Particles/DesertProwlerSkullParticle.cs +++ b/Particles/DesertProwlerSkullParticle.cs @@ -1,16 +1,20 @@ using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; - +using static CalamityMod.CalamityUtils; namespace CalamityMod.Particles { public class DesertProwlerSkullParticle : Particle { public override string Texture => "CalamityMod/Particles/DesertProwlerSkull"; + public override bool UseCustomDraw => true; + public override bool UseHalfTransparency => true; private float Opacity; private Color ColorStart; private Color ColorFade; + private float BaseOpacity; public DesertProwlerSkullParticle(Vector2 position, Vector2 velocity, Color colorStart, Color colorFade, float scale, float opacity) { @@ -20,6 +24,7 @@ namespace CalamityMod.Particles ColorFade = colorFade; Scale = scale; Opacity = opacity; + BaseOpacity = opacity; Rotation = Main.rand.NextFloat(MathHelper.PiOver4 * 0.5f) - MathHelper.PiOver4 * 0.25f; } @@ -43,7 +48,21 @@ namespace CalamityMod.Particles Kill(); Color = Color.Lerp(ColorStart, ColorFade, MathHelper.Clamp((float)((255 - Opacity) - 100) / 80, 0f, 1f)) * (Opacity / 255f); + } + public CurveSegment UpsquashSegment = new CurveSegment(PolyOutEasing, 0f, 1f, 0.2f, 2); + public CurveSegment DownsquashSegment = new CurveSegment(PolyInEasing, 0.2f, 1.2f, -0.3f, 2); + public CurveSegment BumpSquashSegment = new CurveSegment(SineOutEasing, 0.3f, 0.9f, -0.05f); + public CurveSegment BumpSquash2Segment = new CurveSegment(SineInEasing, 0.6f, 0.85f, 0.15f); + public CurveSegment BumpSquash3Segment = new CurveSegment(SineBumpEasing, 0.76f, 1f, 0.05f); + public CurveSegment StaySegment = new CurveSegment(LinearEasing, 0.9f, 1f, 0f); + internal float Squash => PiecewiseAnimation(1 - Opacity / BaseOpacity, new CurveSegment[] { UpsquashSegment, DownsquashSegment, BumpSquashSegment, BumpSquash2Segment, BumpSquash3Segment, StaySegment }); + + public override void CustomDraw(SpriteBatch spriteBatch) + { + Texture2D sprite = GeneralParticleHandler.GetTexture(Type); + Vector2 size = Scale * new Vector2(1 - (Squash - 1) * 0.8f, 1 + (Squash - 1) * 0.8f); + spriteBatch.Draw(sprite, Position - Main.screenPosition, null, Color, Rotation, sprite.Size() / 2f, size, 0, 0); } } }