Old Duke spike blackglow effect for visual clarity

This commit is contained in:
Dominic committed 2022-10-28 20:12:44 -05:00
1 parent 619990a712
commit 45641d30b8
2 files changed
+25 -5

No files matched your search

+8 -5
View File
@@ -1,8 +1,9 @@
using CalamityMod.Buffs.StatDebuffs;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.GameContent;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Enemy
@@ -41,10 +42,12 @@ namespace CalamityMod.Projectiles.Enemy
public override bool PreDraw(ref Color lightColor)
{
lightColor.R = (byte)(200 * Projectile.Opacity);
lightColor.G = (byte)(150 * Projectile.Opacity);
lightColor.B = (byte)(100 * Projectile.Opacity);
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
Texture2D texture = TextureAssets.Projectile[Projectile.type].Value;
Vector2 drawPosition = Projectile.position + Projectile.Size * 0.5f - Main.screenPosition;
Vector2 origin = texture.Size() * 0.5f;
Projectile.DrawBackglow(Color.White, 4f);
Main.spriteBatch.Draw(texture, drawPosition, null, Color.White * Projectile.Opacity, Projectile.rotation, origin, Projectile.scale, 0, 0f);
return false;
}
+17
View File
@@ -505,6 +505,23 @@ namespace CalamityMod
return false;
}
public static void DrawBackglow(this Projectile projectile, Color backglowColor, float backglowArea, Rectangle? frame = null)
{
Texture2D texture = TextureAssets.Projectile[projectile.type].Value;
// Use a fallback for the frame.
frame ??= texture.Frame(1, Main.projFrames[projectile.type], 0, projectile.frame);
Vector2 drawPosition = projectile.position + projectile.Size * 0.5f - Main.screenPosition;
Vector2 origin = frame.Value.Size() * 0.5f;
Color backAfterimageColor = projectile.GetAlpha(backglowColor with { A = 0 });
for (int i = 0; i < 10; i++)
{
Vector2 drawOffset = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * backglowArea;
Main.spriteBatch.Draw(texture, drawPosition + drawOffset, frame, backAfterimageColor, projectile.rotation, origin, projectile.scale, 0, 0f);
}
}
public static void ExplodeandDestroyTiles(Projectile projectile, int explosionRadius, bool checkExplosions, List<int> tilesToCheck, List<int> wallsToCheck)
{
int minTileX = (int)projectile.position.X / 16 - explosionRadius;