From ff1ffcdfbe72769a2b924eccb8d402b939daf52b Mon Sep 17 00:00:00 2001 From: FyloZ Date: Thu, 9 Jul 2020 21:57:29 -0400 Subject: [PATCH] Updated Magma Ball sprites. --- Content/Projectiles/MagmaBall.cs | 41 +++++++++++++++++- Content/Projectiles/MagmaBall.png | Bin 351 -> 227 bytes Content/Projectiles/MagmaBall_Alternative.png | Bin 0 -> 347 bytes 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 Content/Projectiles/MagmaBall_Alternative.png diff --git a/Content/Projectiles/MagmaBall.cs b/Content/Projectiles/MagmaBall.cs index fbb35d5..9958487 100644 --- a/Content/Projectiles/MagmaBall.cs +++ b/Content/Projectiles/MagmaBall.cs @@ -2,6 +2,7 @@ using System; using Decimation.Content.Buffs.Debuffs; using Decimation.Lib.Util; using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -10,12 +11,20 @@ namespace Decimation.Content.Projectiles { public class MagmaBall : DecimationProjectile { + public override string Texture => "Decimation/Content/Projectiles/MagmaBall"; + private bool HitPlayer { get => projectile.ai[0] == 1f; set => projectile.ai[0] = value ? 1 : 0; } + private bool AlternativeTexture + { + get => projectile.localAI[0] == 1f; + set => projectile.localAI[0] = value ? 1 : 0; + } + protected override void Init() { projectile.width = 22; @@ -23,6 +32,8 @@ namespace Decimation.Content.Projectiles projectile.aiStyle = -1; projectile.hostile = true; projectile.penetrate = 1; + + AlternativeTexture = Main.rand.NextBool(); } public override void AI() @@ -48,7 +59,8 @@ namespace Decimation.Content.Projectiles { if (HitPlayer) return; - DustUtils.NewDustCircle(4, projectile.position, projectile.width, projectile.height, DustID.Fire, projectile.scale * 3f); + DustUtils.NewDustCircle(4, projectile.position, projectile.width, projectile.height, DustID.Fire, + projectile.scale * 3f); Tile currentTile = Framing.GetTileSafely((int) Math.Floor(projectile.position.X / 16f), (int) Math.Ceiling(projectile.position.Y / 16f)); @@ -57,5 +69,32 @@ namespace Decimation.Content.Projectiles Main.PlaySound(SoundID.NPCDeath19, projectile.Center); } + + public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) + { + var frameSize = new Vector2(projectile.width, projectile.height); + string texturePath = "Content/Projectiles/MagmaBall"; + if (AlternativeTexture) texturePath += "_Alternative"; + var texture = mod.GetTexture(texturePath); + + + spriteBatch.Draw + ( + texture, + new Vector2( + projectile.position.X - Main.screenPosition.X + frameSize.X / 2, + projectile.position.Y - Main.screenPosition.Y + frameSize.Y / 2 + ), + null, + lightColor, + projectile.rotation + MathHelper.Pi * .5f, + frameSize * 0.5f, + projectile.scale, + SpriteEffects.None, + 0f + ); + + return false; + } } } \ No newline at end of file diff --git a/Content/Projectiles/MagmaBall.png b/Content/Projectiles/MagmaBall.png index 5fd08d91b50bcef53e0ee389d1a7fe906c74020e..dd8f58484a47cde2aa85713599c98bf52e38b21c 100644 GIT binary patch literal 227 zcmV<90382`P)TLWC@mI7d9~)$UF|ClR?RvOuisIUItV0p3flZuDtc`{2e6E zH9rd2zq8~z*Qu0jqvT>f=5>PtfE1M z=>k*})*+Jq4>G;L3=;%mqo*MLP)?w^oJ{hatR?_R7IcF=AYgjrngAfJ*=vvm0&X?| dKms5m&=3913B%6fivIur002ovPDHLkV1h&VSaARV literal 351 zcmV-l0igbgP)ktN_9svC@Mpt!gc*kS_>JutoV;0_cQuF?63 z!WY&54dFw50&_Vd%?)<9_dszW%;hlW;qn1Y9v&Akm&064b%Xz34g#kJ``k}p%h4@> zxd`0{xO{SOG9Orqk>&<7oVW+J$$qH_m_~Qu%a_lvreAm%LtP5v!(B{ugJCwng5>qg z$6%q5EBq)f%w_(H!nfD_1LosQ$8<9o79_7PvZA=~;B^*A96())?jv|=fR-8XvH}(q zR5utsNYEn_JxRb)4SH%hbYKtIu_#3yNC4gCu;fRv!7u~Rv-*V_m%vi!E=13%I9*J0 xgV8O(o9!4F7+@}i=R86haMdj6`p^vq0PWPq=h3v2ng9R*07*qoM6N<$f&gSGln?*_ diff --git a/Content/Projectiles/MagmaBall_Alternative.png b/Content/Projectiles/MagmaBall_Alternative.png new file mode 100644 index 0000000000000000000000000000000000000000..56031ad241f5ab3c86d38bef8ebe47ac586e0ed5 GIT binary patch literal 347 zcmeAS@N?(olHy`uVBq!ia0vp^LLkh+1|-AI^@Rf|#^NA%Cx&(BWL^R}Ea{HEjtmSN z`?>!lvI6;>1s;*b3=DjSL74G){)!Z!;0I3^#}EtuM`>tjN=AHMkJtRx5rmMo8$R?3wfp0ZkVIE^Ir-zgw#mP8tyEqEk1Bdc17dD+ESH&gMA4w-Ds zytW2=KR@6zn0s~s=Q7@F4o6ly9T0JTb!KXUlo~(t6>jA(H#Ws76>8XTj# znZ>95ZR3ZPa&8uvFTUFVdQ&MBb@0Kn{n6#xJL literal 0 HcmV?d00001