public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { float alpha = MathHelper.Clamp(projectile.localAI[0] / AppearTime, 0f, 1f) * MathHelper.Clamp((projectile.timeLeft - 50) / AppearTime, 0f, 1f); spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); if (alpha > 0) { Vector2[] points = new Vector2[] { startingloc, startingloc + projectile.velocity }; TrailHelper trail = new TrailHelper("BasicEffectAlphaPass", mod.GetTexture("SmallLaser")); //UnifiedRandom rando = new UnifiedRandom(projectile.whoAmI); Color colorz = Color.Lerp(color1, Color.White, 0.50f); Color colorz2 = color2; trail.color = delegate(float percent) { return(Color.Lerp(colorz, colorz2, percent)); }; trail.projsize = Vector2.Zero; trail.coordOffset = new Vector2(0, Main.GlobalTime * -1f); trail.coordMultiplier = new Vector2(1f, 1f); trail.doFade = false; trail.trailThickness = 16; trail.trailThicknessIncrease = 0; //trail.capsize = new Vector2(6f, 0f); trail.strength = alpha * 1f; trail.DrawTrail(points.ToList(), projectile.Center); } Texture2D mainTex = SGAmod.ExtraTextures[96]; Texture2D glowTex = ModContent.GetTexture("SGAmod/Glow"); float alpha2 = MathHelper.Clamp(projectile.localAI[0] / 3f, 0f, 1f) * MathHelper.Clamp(projectile.timeLeft / 25f, 0f, 1f); if (GetType() != typeof(Accessories.RefractorLaserProj)) { spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.GameViewMatrix.TransformationMatrix); Effect effect = SGAmod.TextureBlendEffect; effect.Parameters["coordMultiplier"].SetValue(new Vector2(1f, 1f)); effect.Parameters["coordOffset"].SetValue(new Vector2(0f, 0f)); effect.Parameters["noiseMultiplier"].SetValue(new Vector2(1f, 1f)); effect.Parameters["noiseOffset"].SetValue(new Vector2(0f, 0f)); effect.Parameters["Texture"].SetValue(SGAmod.Instance.GetTexture("Extra_49c")); effect.Parameters["noiseTexture"].SetValue(SGAmod.Instance.GetTexture("Extra_49c")); effect.Parameters["noiseProgress"].SetValue(projectile.localAI[0] / 30f); effect.Parameters["textureProgress"].SetValue(0f); effect.Parameters["noiseBlendPercent"].SetValue(1f); effect.Parameters["strength"].SetValue(alpha2); effect.Parameters["colorTo"].SetValue(color1.ToVector4() * new Vector4(0.5f, 0.5f, 0.5f, 1f)); effect.Parameters["colorFrom"].SetValue(Color.Black.ToVector4()); effect.CurrentTechnique.Passes["TextureBlend"].Apply(); Main.spriteBatch.Draw(mainTex, startingloc + projectile.velocity - Main.screenPosition, null, Color.White, projectile.rotation, mainTex.Size() / 2f, (alpha2 + (projectile.localAI[0] / 60f)) * 0.75f, default, 0);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D inner = Main.projectileTexture[projectile.type]; Vector2 textureOrigin = new Vector2(inner.Width / 2, inner.Height / 2); Color colorx = (projectile.localAI[0] % 2 == 0 ? Color.Red : Color.Blue); for (int i = 0; i < projectile.oldPos.Length; i += 1) //dumb hack to get the trails to not appear at 0,0 { if (projectile.oldPos[i] == default) { projectile.oldPos[i] = projectile.position; } } TrailHelper trail = new TrailHelper("FadedBasicEffectPass", mod.GetTexture("TiledPerlin")); trail.projsize = projectile.Hitbox.Size() / 2f; trail.coordOffset = new Vector2(Main.GlobalTime * -2.5f, 0); trail.trailThickness = 2; trail.trailThicknessIncrease = 4; trail.strength = MathHelper.Clamp(projectile.timeLeft / 20f, 0f, 0.5f); trail.DrawTrail(projectile.oldPos.ToList(), projectile.Center); Texture2D tex2 = Main.projectileTexture[ModContent.ProjectileType <SpecterangProj>()]; for (int i = projectile.oldPos.Length - 1; i > 0; i -= 1) { spriteBatch.Draw(tex2, projectile.oldPos[i] + (new Vector2(projectile.width, projectile.height) / 2f) - Main.screenPosition, null, colorx * 0.75f * MathHelper.Clamp(projectile.timeLeft / 20f, 0f, 1f) * 0.30f * (1f - (i / (float)projectile.oldPos.Length)), projectile.rotation, tex2.Size() / 2f, new Vector2(0.5f, 1f) * projectile.scale, SpriteEffects.FlipVertically, 0); } spriteBatch.Draw(inner, projectile.Center - Main.screenPosition, null, Color.White * 0.75f * MathHelper.Clamp(projectile.timeLeft / 20f, 0f, 1f), projectile.rotation, textureOrigin, new Vector2(1f, 1f) * projectile.scale, SpriteEffects.FlipVertically, 0); spriteBatch.Draw(tex2, projectile.Center - Main.screenPosition, null, colorx * 0.75f * MathHelper.Clamp(projectile.timeLeft / 20f, 0f, 1f) * 0.5f, projectile.rotation, tex2.Size() / 2f, new Vector2(1.5f, 0.75f) * projectile.scale, SpriteEffects.FlipVertically, 0); return(false); }
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { for (int i = 0; i < projectile.oldPos.Length; i += 1) //dumb hack to get the trails to not appear at 0,0 { if (projectile.oldPos[i] == default) { projectile.oldPos[i] = projectile.position; } } TrailHelper trail = new TrailHelper("DefaultPass", mod.GetTexture("Noise")); trail.color = delegate(float percent) { return(Color.Magenta); }; trail.projsize = projectile.Hitbox.Size() / 2f; trail.coordOffset = new Vector2(0, Main.GlobalTime * -1f); trail.trailThickness = 13; trail.capsize = new Vector2(8f, 0f); trail.strength = strength; trail.trailThicknessIncrease = 15; trail.DrawTrail(projectile.oldPos.ToList(), projectile.Center); return(false); }
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { if (projectile.ai[1] > 0) { return(false); } Player owner = Main.player[projectile.owner]; Texture2D tex = Main.projectileTexture[projectile.type]; Vector2 drawOrigin = new Vector2(tex.Width, tex.Height / 6) / 2f; //oldPos.Length - 1 //for (int k = oldPos.Length - 1; k >= 0; k -= 2) int k = 0; Vector2 drawPos = ((oldPos[k] - Main.screenPosition)) + new Vector2(0f, 4f); Color color = (Main.hslToRgb((projectile.ai[0] / 8f) % 1f, 1f, 0.9f)) * (1f - (float)(k + 1) / (float)(oldPos.Length + 2)); int timing = (int)(projectile.localAI[0] / 8f); timing %= 6; timing *= ((tex.Height) / 6); List <Vector2> list = oldPos.ToList(); //list.Insert(0, projectile.Center); for (int z = 0; z < list.Count; z += 1) { float percent = (z / (float)list.Count) * (0f + (float)Math.Sin((owner.SGAPly().timer / 20f) - (z / 5f)) * 0.5f); list[z] += (owner.Center - list[z]) * percent; } TrailHelper trail = new TrailHelper("DefaultPass", SGAmod.ExtraTextures[21]); trail.color = delegate(float percent) { return(Color.Pink); }; trail.projsize = Vector2.Zero; trail.trailThickness = 2; trail.trailThicknessIncrease = 6; trail.DrawTrail(list, projectile.Center); float angle = (float)(((1f + projectile.ai[0] / 8f)) + 2.0 * Math.PI * (projectile.ai[0] / ((double)8f))); spriteBatch.Draw(tex, drawPos, new Rectangle(0, timing, tex.Width, (tex.Height - 1) / 6), color, (float)Math.Sin(-angle), drawOrigin, projectile.scale, SpriteEffects.None, 0f); return(false); }
//Beams and glowing are drawn under the player public override bool PreDrawExtras(SpriteBatch spriteBatch) { float alpha2 = MathHelper.Clamp((projectile.localAI[0] - 0) / 60f, 0f, 1f) * MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.TransformationMatrix); Texture2D glowOrb = ModContent.GetTexture("SGAmod/GlowOrb"); Vector2 sizer = glowOrb.Size() / 2f; foreach (Projectile asteriod in Asteriods) { float alphaglow = MathHelper.Clamp(asteriod.localAI[0] / 60f, 0f, Math.Min(asteriod.timeLeft / 60f, 1f)) * alpha2; spriteBatch.Draw(glowOrb, asteriod.Center - Main.screenPosition, null, Color.Lerp(Color.White, Color.Aqua, 0.50f) * 0.40f * alphaglow, 0, sizer, projectile.scale * 0.20f, SpriteEffects.None, 0); } foreach (MandalaArm arm in arms) { float alpha = MathHelper.Clamp((arm.time - 60) / 30f, 0f, 1f) * MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f) * MathHelper.Clamp(arm.despawnTimer / 8f, 0f, 1f); List <Vector2> toThem = new List <Vector2>(); toThem.Add(arm.Position); toThem.Add(DrawPosition); TrailHelper trail = new TrailHelper("FadedBasicEffectPass", Main.sunTexture); trail.projsize = Vector2.Zero; trail.coordOffset = new Vector2(0, 0f); trail.coordMultiplier = new Vector2(1f, 0.4f); trail.trailThickness = 16; trail.trailThicknessIncrease = -12; trail.doFade = false; trail.strength = 1f; trail.color = delegate(float percent) { return(Color.CornflowerBlue * (MathHelper.Clamp((alpha + percent) - 1f, 0f, 1f))); }; trail.DrawTrail(toThem, DrawPosition); } Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.GameViewMatrix.TransformationMatrix); return(false); }
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Player owner = Main.player[projectile.owner]; List <Vector2> vects = new List <Vector2>(); for (int i = -96; i <= 96; i += 8) { float scalar = 1f + Math.Max(Math.Abs(i / 300f) - 0.05f, 0f); double scaleoffset = (noise.Noise((int)projectile.Center.X + i, 0) * 48.00) * (scalar - ScaleProperty); vects.Add(new Vector2(projectile.Center.X + i, projectile.Center.Y + (float)scaleoffset)); } for (int j = 0; j < (ScalePropertyColor2 > 0 ? 2 : 1); j += 1) { TrailHelper trail = new TrailHelper("BasicEffectPass", j == 0 ? SGAmod.PlatformTex : Main.magicPixel); trail.projsize = new Vector2(0, owner.height / 2); trail.trailThickness = 4; trail.doFade = false; if (j == 0) { trail.color = delegate(float percent) { return(Color.White * MathHelper.Clamp((float)Math.Sin((-0.2f + percent * 1.40f) * MathHelper.Pi) * 3f, 0f, 1f)); }; } else { trail.color = delegate(float percent) { return(Color.Lerp(Color.OrangeRed, Color.Purple, 0.50f + (float)Math.Sin(((percent * 160f) + owner.SGAPly().timer) / 10f) * 0.50f) * MathHelper.Clamp(((float)Math.Sin((-0.2f + percent * 1.40f) * MathHelper.Pi) * 3f), 0f, 1f) * ScalePropertyColor2); }; } trail.coordMultiplier = new Vector2(1f, (96 * 2) / 16f); trail.coordOffset = new Vector2(0, projectile.Center.X / 16); trail.strength = ScaleProperty; trail.trailThicknessIncrease = 0; trail.DrawTrail(vects, projectile.Center); } Texture2D texture = Main.projectileTexture[mod.ProjectileType(this.GetType().Name)]; Vector2 origin = new Vector2((float)texture.Width * 0.5f, (float)texture.Height * 0.5f); //spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, null, Color.White, projectile.rotation, origin, new Vector2(1f, 1f), projectile.spriteDirection > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically, 0f); return(false); }
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D tex = Main.projectileTexture[projectile.type]; Player player = Main.player[projectile.owner]; float angleadd = MathHelper.Clamp(-projectile.ai[0] / 45f, 0f, 1f); float velAdd = angleadd * (projectile.velocity.X) * 0.07f; Vector2 drawOrigin = new Vector2(tex.Width, tex.Height) / 2f; Vector2 drawPos = projectile.Center - Main.screenPosition; Color color = Color.Lerp((projectile.GetAlpha(lightColor) * 0.5f), prismColor, 0.75f); for (int i = 0; i < projectile.oldPos.Length; i += 1) //dumb hack to get the trails to not appear at 0,0 { if (projectile.oldPos[i] == default) { projectile.oldPos[i] = projectile.position; } } TrailHelper trail = new TrailHelper("DefaultPass", mod.GetTexture("Noise")); trail.color = delegate(float percent) { return(color); }; trail.projsize = projectile.Hitbox.Size() / 2f; trail.coordOffset = new Vector2(0, Main.GlobalTime * -1f); trail.trailThickness = 4; trail.trailThicknessIncrease = 6; trail.strength = startupDelay; trail.DrawTrail(projectile.oldPos.ToList(), projectile.Center); Texture2D tex2 = Main.projectileTexture[ModContent.ProjectileType <SpecterangProj>()]; if (projectile.localAI[1] > 0) { for (int i = projectile.oldPos.Length - 1; i > 0; i -= 1) { spriteBatch.Draw(tex2, projectile.oldPos[i] + (new Vector2(projectile.width, projectile.height) / 2f) - Main.screenPosition, null, (prismColor * 0.50f) * MathHelper.Clamp(projectile.localAI[1] / 75f, 0f, 1f) * (1f - (i / (float)projectile.oldPos.Length)), velAdd + projectile.rotation + MathHelper.Pi, tex2.Size() / 2f, projectile.scale, default, 0);
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { Texture2D tex = mod.GetTexture("Items/Weapons/Ammo/SoulboundBullet"); Vector2 drawOrigin = new Vector2(tex.Width, tex.Height) / 2f; //oldPos.Length - 1 /*for (int k = oldPos.Length - 1; k >= 0; k -= 1) * { * Vector2 drawPos = ((oldPos[k] - Main.screenPosition)) + new Vector2(0f, 0f); * Color color = Color.Lerp(Color.Lime, lightColor, (float)k / (oldPos.Length + 1)); * float alphaz = (1f - (float)(k + 1) / (float)(oldPos.Length + 2)) * 1f; * spriteBatch.Draw(tex, drawPos, null, color * alphaz, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); * }*/ //TrailHelper trailEffect = new TrailHelper("BasicEffectAlphaPass", Main.extraTexture[21]); TrailHelper trailEffect = new TrailHelper("DefaultPass", mod.GetTexture("Noise")); Color color = Color.Lerp(Color.CornflowerBlue, Color.PaleTurquoise, projectile.Opacity); trailEffect.color = delegate(float percent) { return(color); }; trailEffect.strength = projectile.Opacity * MathHelper.Clamp(projectile.timeLeft / 60f, 0f, 1f) * 2f; trailEffect.trailThickness = 2f; trailEffect.coordMultiplier = new Vector2(1f, 2f); trailEffect.coordOffset = new Vector2(0, Main.GlobalTime * -2f); trailEffect.trailThicknessIncrease = 2f; trailEffect.capsize = new Vector2(4f, 4f); trailEffect.DrawTrail(oldPos.ToList()); //if (projectile.ai[0] == 0) //spriteBatch.Draw(tex, projectile.Center-Main.screenPosition, null, Color.AliceBlue * 1f, projectile.rotation, drawOrigin, projectile.scale, SpriteEffects.None, 0f); return(false); }
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { for (int i = 0; i < projectile.oldPos.Length; i += 1) //dumb hack to get the trails to not appear at 0,0 { if (projectile.oldPos[i] == default) { projectile.oldPos[i] = projectile.position; } } TrailHelper trail = new TrailHelper("DefaultPass", mod.GetTexture("Noise")); trail.color = delegate(float percent) { return(Main.hslToRgb((percent * 1f) % 1f, 0.85f, 0.75f)); }; trail.projsize = projectile.Hitbox.Size() / 2f; trail.coordOffset = new Vector2(0, Main.GlobalTime * -1f); trail.trailThickness = 13; trail.capsize = new Vector2(8f, 0f); trail.strength = strength; trail.trailThicknessIncrease = 15; trail.DrawTrail(projectile.oldPos.ToList(), projectile.Center); Texture2D texaz = SGAmod.ExtraTextures[110]; for (float xx = -3; xx < 3.5f; xx += 0.5f) { for (float i = 1f; i < 3; i += 0.4f) { float scalerz = 0.85f + (float)Math.Cos(Main.GlobalTime * 1.25f * (Math.Abs(xx) + i)) * 0.3f; spriteBatch.Draw(texaz, (projectile.Center + ((projectile.velocity.ToRotation() + (float)Math.PI / 4f)).ToRotationVector2() * (xx * 9f)) - Main.screenPosition, null, Color.Yellow * (0.5f / (i + xx)) * 0.25f, projectile.velocity.ToRotation() + (float)Math.PI / 2f, new Vector2(texaz.Width / 2f, texaz.Height / 4f), (new Vector2(1 + i, 1 + i * 1.5f) / (1f + Math.Abs(xx))) * scalerz * projectile.scale, SpriteEffects.None, 0f); } } return(false); }
public override void Draw(Texture2D texa, SpriteBatch spriteBatch, Color lightColor) { oldPos[0] = position; TrailHelper trail = new TrailHelper("DefaultPass", SGAmod.Instance.GetTexture("Perlin")); trail.color = delegate(float percent) { return(Color.DarkOliveGreen); }; trail.projsize = projectile.Hitbox.Size() / 2f; trail.trailThickness = 4; trail.trailThicknessIncrease = 6; trail.capsize = new Vector2(6f, 0f); trail.strength = Math.Max(1f - chargeTimer / 15f, 0f); trail.DrawTrail(oldPos, position); float scale = 1; int frame = texa.Height / 4; float alpha = MathHelper.Clamp(timer / 10f, 0f, 1f); spriteBatch.Draw(texa, position - Main.screenPosition, new Rectangle(0, ((int)((timer / 3f) % 4)) * frame, texa.Width, frame), lightColor * alpha, velocity.X / 20f, new Vector2(texa.Width, frame) / 2f, scale, velocity.X > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); //spriteBatch.Draw(texa, position - Main.screenPosition, new Rectangle(0,0,64,64), lightColor * alpha, -velocity.X / 5f, new Vector2(texa.Width, frame) / 2f, scale, velocity.X > 0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f); }
public override bool PreDraw(SpriteBatch spriteBatch, Color drawColor) { Texture2D tex = Main.projectileTexture[projectile.type]; Vector2 drawOrigin = new Vector2(tex.Width, tex.Height / 4) / 2f; Vector2 drawPos = ((projectile.Center - Main.screenPosition)); Vector2 adder = Vector2.Zero; Player owner = Main.player[projectile.owner]; int timing = (int)(Main.GlobalTime * (8f)); timing %= 4; int mydirection = projectile.spriteDirection; if (timing == 0) { adder = ((projectile.rotation + (float)Math.PI / 2f).ToRotationVector2() * (8f * mydirection)); } if (projectile.ai[0] > 1) { TrailHelper trail = new TrailHelper("FadedBasicEffectPass", mod.GetTexture("Noise")); trail.projsize = projectile.Hitbox.Size() / 2f; trail.coordOffset = new Vector2(0, Main.GlobalTime * -0.5f); trail.trailThickness = 6; trail.trailThicknessIncrease = 36; trail.strength = alphaStrength * MathHelper.Clamp(cosmeticTrailFade, 0f, 1f); trail.capsize = new Vector2(8, 0); trail.DrawTrail(projectile.oldPos.ToList(), projectile.Center); } if (projectile.ai[0] < 28 && projectile.ai[0] >= 0) { List <Vector2> Swirl = new List <Vector2>(); UnifiedRandom rando = new UnifiedRandom(projectile.whoAmI * 753); Vector2 vex = Vector2.One.RotatedBy(rando.NextFloat(MathHelper.TwoPi)) * 48f; float[] rando2 = { rando.NextFloat(MathHelper.TwoPi), rando.NextFloat(MathHelper.TwoPi), rando.NextFloat(MathHelper.TwoPi) }; float[] rando3 = { rando.NextFloat(0.1f, 0.25f), rando.NextFloat(0.1f, 0.25f), rando.NextFloat(0.1f, 0.25f) }; for (float ix = 0; ix < 24; ix += 0.10f) { float i = (-projectile.localAI[0] / 2f) + ix; Matrix matrix = Matrix.CreateRotationZ((i * rando3[0]) + rando2[0]) * Matrix.CreateRotationY((i * rando3[1]) + rando2[1]) * Matrix.CreateRotationX((i * rando3[2]) + rando2[2]); Swirl.Add(Vector2.Transform(vex, matrix) + owner.MountedCenter); } TrailHelper trail = new TrailHelper("FadedBasicEffectPass", mod.GetTexture("Perlin")); trail.coordOffset = new Vector2(Main.GlobalTime * -0.5f, 0f); trail.trailThickness = 6; trail.trailThicknessIncrease = 12; trail.strength = alphaStrength * MathHelper.Clamp(1f - (projectile.ai[0] / 50f), 0f, 0.75f); trail.capsize = new Vector2(8, 0); trail.color = delegate(float percent) { return(Main.hslToRgb(((1f - percent) + Main.GlobalTime / 3f) % 1f, 0.9f, 0.75f)); }; trail.DrawTrail(Swirl, projectile.Center); } if (projectile.ai[0] < 0) { for (float i = -1; i < 2; i += 0.4f) { Vector2 scaleup = new Vector2((float)Math.Abs(Math.Sin(Main.GlobalTime / 1.1694794f)), 1f) * MathHelper.Clamp(-projectile.ai[0] / 30, 0f, 1f) * alphaStrength; Texture2D texture7 = SGAmod.ExtraTextures[34]; spriteBatch.Draw(texture7, projectile.Center - Main.screenPosition, null, Main.hslToRgb((Main.GlobalTime) % 1f, 1f, 0.75f) * 0.50f, -Main.GlobalTime * 17.134f * i, new Vector2(texture7.Width / 2f, texture7.Height / 2f), scaleup, SpriteEffects.None, 0f); texture7 = SGAmod.HellionTextures[6]; spriteBatch.Draw(texture7, projectile.Center - Main.screenPosition, null, Main.hslToRgb((Main.GlobalTime) % 1f, 1f, 0.75f) * 0.50f, Main.GlobalTime * 17.134f * i, new Vector2(texture7.Width / 2f, texture7.Height / 2f), scaleup, SpriteEffects.None, 0f); } } timing *= ((tex.Height) / 4); for (int k = (projectile.oldRot.Length / 2) - 1; k >= 0; k -= 1) { //Color color = Color.Lerp(Color.Lime, lightColor, (float)k / (oldPos.Length + 1)); float alphaxx = MathHelper.Clamp((projectile.velocity.Length() - 3f) / 20f, 0f, 0.1f); float alphaz = (1f - (float)(k + 1) / (float)(projectile.oldRot.Length + 2)) * (k > 0 ? alphaxx : 1f); float scaleffect = 1f; //Color fancyColor = Main.hslToRgb(((k / projectile.oldRot.Length) + projectile.localAI[0] / 30f) % 1f, 1f, 0.75f); drawPos = ((projectile.oldPos[k] - Main.screenPosition)); spriteBatch.Draw(tex, drawPos + (drawOrigin / 4f) - adder, new Rectangle(0, timing + 2, tex.Width, (tex.Height - 1) / 4), ((drawColor * alphaz) * (projectile.Opacity)) , projectile.rotation - (float)(mydirection < 0 ? Math.PI : 0), drawOrigin, scaleffect, mydirection > 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 0f); } return(false); }
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor) { //VertexBuffer vertexBuffer; /*basicEffect.World = WVP.World(); * basicEffect.View = WVP.View(Main.GameViewMatrix.Zoom); * basicEffect.Projection = WVP.Projection(); * basicEffect.VertexColorEnabled = true; * basicEffect.TextureEnabled = true; * basicEffect.Texture = SGAmod.ExtraTextures[21];*/ /*effect.Parameters["WorldViewProjection"].SetValue(WVP.View(Main.GameViewMatrix.Zoom) * WVP.Projection()); * effect.Parameters["imageTexture"].SetValue(SGAmod.ExtraTextures[21]); * effect.Parameters["coordOffset"].SetValue(new Vector2(0, Main.GlobalTime * -1f)); * effect.Parameters["coordMultiplier"].SetValue(1f); * effect.Parameters["strength"].SetValue(1f); * string pass = "******"; * * int totalcount = projectile.oldPos.Length; * * for(int i=0;i< projectile.oldPos.Length; i += 1)//dumb hack to get the trails to not appear at 0,0 * { * if (projectile.oldPos[i]==default) * projectile.oldPos[i] = projectile.position; * } * * VertexPositionColorTexture[] vertices = new VertexPositionColorTexture[((totalcount + 1) * 6)]; * * Vector3[] prevcoords = { Vector3.One, Vector3.One }; * * float coordprogress = 0; * for (int k = 1; k < totalcount; k += 1) * { * float fraction = (float)k / (float)totalcount; * float fractionPlus = (float)(k + 1) / (float)totalcount; * * Vector2 size = new Vector2(projectile.width, projectile.height) / 2f; * Vector2 trailloc = projectile.oldPos[k] + size; * Vector2 prev2 = projectile.oldPos[k - 1] + size; * if (prev2 == default) * prev2 = trailloc; * * //You want prims, you get prims! * * float thickness = 13+(1f-(k/(float)projectile.oldPos.Length))*16; * * Vector2 normal = Vector2.Normalize(trailloc - prev2); * Vector3 left = (normal.RotatedBy(MathHelper.Pi / 2f) * (thickness)).ToVector3(); * Vector3 right = (normal.RotatedBy(-MathHelper.Pi / 2f) * (thickness)).ToVector3(); * * Vector3 drawtop = (trailloc - Main.screenPosition).ToVector3(); * Vector3 drawbottom = (prev2 - Main.screenPosition).ToVector3(); * * if (prevcoords[0] == Vector3.One) * { * prevcoords = new Vector3[2] { drawbottom + left, drawbottom + right }; * } * * Color color = Color.Lerp(Color.White, Color.White * 0f, fraction); * Color color2 = Color.Lerp(Color.White, Color.White * 0f, fractionPlus); * * vertices[0 + (k * 6)] = new VertexPositionColorTexture(prevcoords[0], color, new Vector2(0, fractionPlus)); * vertices[1 + (k * 6)] = new VertexPositionColorTexture(drawtop + right, color2, new Vector2(1, fraction)); * vertices[2 + (k * 6)] = new VertexPositionColorTexture(drawtop + left, color2, new Vector2(0, fraction)); * * vertices[3 + (k * 6)] = new VertexPositionColorTexture(prevcoords[0], color, new Vector2(0, fractionPlus)); * vertices[4 + (k * 6)] = new VertexPositionColorTexture(prevcoords[1], color, new Vector2(1, fractionPlus)); * vertices[5 + (k * 6)] = new VertexPositionColorTexture(drawtop + right, color2, new Vector2(1, fraction)); * * prevcoords = new Vector3[2] { drawtop + left, drawtop + right }; * * //Idglib.DrawTether(SGAmod.ExtraTextures[21], prev2, goto2, 1f, 0.25f, 1f, Color.Magenta); * * } * * vertexBuffer = new VertexBuffer(Main.graphics.GraphicsDevice, typeof(VertexPositionColorTexture), vertices.Length, BufferUsage.WriteOnly); * vertexBuffer.SetData<VertexPositionColorTexture>(vertices); * * Main.graphics.GraphicsDevice.SetVertexBuffer(vertexBuffer); * * RasterizerState rasterizerState = new RasterizerState(); * rasterizerState.CullMode = CullMode.None; * Main.graphics.GraphicsDevice.RasterizerState = rasterizerState; * * * * effect.CurrentTechnique.Passes[pass].Apply(); * Main.graphics.GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, ((totalcount + 1) * 2)); * */ for (int i = 0; i < projectile.oldPos.Length; i += 1)//dumb hack to get the trails to not appear at 0,0 { if (projectile.oldPos[i] == default) { projectile.oldPos[i] = projectile.position; } } TrailHelper trail = new TrailHelper("BasicEffectPass", Main.extraTexture[21]); trail.projsize = projectile.Hitbox.Size() / 2f; trail.coordOffset = new Vector2(0, Main.GlobalTime * -1f); trail.trailThickness = 13; trail.trailThicknessIncrease = 15; trail.DrawTrail(projectile.oldPos.ToList(), projectile.Center); Texture2D texture = Main.projectileTexture[mod.ProjectileType(this.GetType().Name)]; Vector2 origin = new Vector2((float)texture.Width * 0.5f, (float)texture.Height * 0.5f); spriteBatch.Draw(texture, projectile.Center + new Vector2(1, 0) - Main.screenPosition, null, Color.White, projectile.rotation, origin, new Vector2(1f, 1f), projectile.spriteDirection > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically, 0f); return(false); }