Urchin mace visual polish
This commit is contained in:
1 parent
264d869050
commit
6306f3d097
4 files changed
+68
-3
No files matched your search
@@ -0,0 +1,45 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class UrchinSpikeParticle : Particle
|
||||
{
|
||||
public override string Texture => "CalamityMod/Particles/UrchinSpikes";
|
||||
public override bool UseCustomDraw => true;
|
||||
public override bool SetLifetime => true;
|
||||
public override int FrameVariants => 6;
|
||||
|
||||
public float Opacity;
|
||||
|
||||
public UrchinSpikeParticle(Vector2 position, Vector2 speed, float rotation, float scale = 1f, float opacity = 1f, int lifetime = 20)
|
||||
{
|
||||
Position = position;
|
||||
Scale = scale;
|
||||
Color = Color.White;
|
||||
Opacity = opacity;
|
||||
Velocity = speed;
|
||||
Rotation = rotation;
|
||||
Lifetime = lifetime;
|
||||
Variant = Main.rand.Next(6);
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
Color = Lighting.GetColor((int)Position.X / 16, (int)Position.Y / 16) * Opacity;
|
||||
Velocity *= 0.9f;
|
||||
if (Velocity.Length() <= 0.01f)
|
||||
GeneralParticleHandler.RemoveParticle(this);
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Texture2D texture = GeneralParticleHandler.GetTexture(Type);
|
||||
Rectangle frame = new Rectangle(8 * Variant, 0, 6, 10);
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, frame, Color, Rotation, frame.Size() * 0.5f, Scale, SpriteEffects.None, 0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 571 B |
@@ -5,6 +5,7 @@ using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
@@ -39,8 +40,8 @@ namespace CalamityMod.Projectiles.Melee
|
||||
for (int i = 0; i < dustCount; i++)
|
||||
{
|
||||
float angle = i / (float)dustCount * MathHelper.TwoPi + offset;
|
||||
Vector2 dustPos = Projectile.Center + angle.ToRotationVector2() * 40f;
|
||||
Dust dust = Dust.NewDustPerfect(dustPos, 176, (angle - MathHelper.PiOver2 * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * 5f + Projectile.velocity, Scale: Main.rand.NextFloat(1f, 2f));
|
||||
Vector2 dustPos = Projectile.Center + angle.ToRotationVector2() * 46f;
|
||||
Dust dust = Dust.NewDustPerfect(dustPos, 176, (angle - MathHelper.PiOver2 * Math.Sign(Projectile.velocity.X)).ToRotationVector2() * 8f + Projectile.velocity, Scale: Main.rand.NextFloat(1.6f, 3f));
|
||||
dust.noGravity = true;
|
||||
}
|
||||
}
|
||||
@@ -50,6 +51,8 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
|
||||
SpriteEffects flip = Math.Sign(Projectile.velocity.X) < 0? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
|
||||
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, lightColor * 0.3f, Projectile.rotation * 1.2f, texture.Size() / 2f, 1.5f, flip, 0);
|
||||
Main.spriteBatch.Draw(texture, Projectile.Center - Main.screenPosition, null, lightColor * 0.4f, Projectile.rotation, texture.Size() / 2f, 2f, flip, 0);
|
||||
|
||||
return false;
|
||||
|
||||
@@ -5,6 +5,7 @@ using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
using Terraria.Audio;
|
||||
using System;
|
||||
using CalamityMod.Particles;
|
||||
|
||||
namespace CalamityMod.Projectiles.Melee
|
||||
{
|
||||
@@ -79,6 +80,11 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Projectile.soundDelay = 28;
|
||||
}
|
||||
|
||||
if (Windup == MaxWindup && Owner.whoAmI == Main.myPlayer)
|
||||
{
|
||||
SoundEngine.PlaySound(SoundID.Item43, Owner.Center);
|
||||
}
|
||||
|
||||
Windup++;
|
||||
}
|
||||
|
||||
@@ -105,6 +111,17 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Owner.itemAnimation = 2;
|
||||
}
|
||||
|
||||
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
||||
{
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
float angle = Main.rand.NextFloat(MathHelper.TwoPi);
|
||||
|
||||
Particle spike = new UrchinSpikeParticle(target.Center + angle.ToRotationVector2() * 15f, angle.ToRotationVector2() * 6f, angle + MathHelper.PiOver2, Main.rand.NextFloat(1f, 1.3f), lifetime: Main.rand.Next(10) + 25);
|
||||
GeneralParticleHandler.SpawnParticle(spike);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Owner.direction = Math.Sign(Owner.Calamity().mouseWorld.X - Owner.position.X);
|
||||
@@ -112,7 +129,7 @@ namespace CalamityMod.Projectiles.Melee
|
||||
Texture2D maceTexture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Texture2D whirlpoolTexture = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Melee/RedtideWhirlpool").Value;
|
||||
|
||||
float whirlpoolScale = WindupProgress * 2f;
|
||||
float whirlpoolScale = MathHelper.Clamp(WindupProgress * 3f - 0.4f, 0f, 1f) * 2f;
|
||||
float whirlpoolOpacity = WindupProgress * 0.2f + (float)Math.Sin(Main.GlobalTimeWrappedHourly * 3f) * 0.1f;
|
||||
float whirlpoolRotation = Windup * 0.34f * Owner.direction;
|
||||
SpriteEffects flip = Owner.direction < 0 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
|
||||
Reference in new issue
Block a user