Resprited Heavenly Gale, yes strings attached
This commit is contained in:
1 parent
75e07d81d2
commit
700ede4f01
6 files changed
+20
-22
No files matched your search
@@ -2,6 +2,7 @@
|
||||
using CalamityMod.Rarities;
|
||||
using CalamityMod.Tiles.Furniture.CraftingStations;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.DataStructures;
|
||||
@@ -48,7 +49,7 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
Item.damage = 300;
|
||||
Item.DamageType = DamageClass.Ranged;
|
||||
Item.width = 138;
|
||||
Item.height = 138;
|
||||
Item.height = 176;
|
||||
Item.useAnimation = Item.useTime = ArrowShootTime; // 40
|
||||
Item.useStyle = ItemUseStyleID.Shoot;
|
||||
Item.noMelee = true;
|
||||
@@ -68,6 +69,9 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
// Shoot via the projectile only
|
||||
public override bool CanShoot(Player player) => false;
|
||||
|
||||
public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI)
|
||||
=> Item.DrawItemGlowmaskSingleFrame(spriteBatch, rotation, ModContent.Request<Texture2D>("CalamityMod/Items/Weapons/Ranged/HeavenlyGaleGlow").Value);
|
||||
|
||||
public override void AddRecipes()
|
||||
{
|
||||
CreateRecipe().
|
||||
@@ -80,4 +84,4 @@ namespace CalamityMod.Items.Weapons.Ranged
|
||||
Register();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 6.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@@ -27,29 +27,27 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
return firstHalf + secondHalf;
|
||||
}
|
||||
}
|
||||
public float StringReelbackDistance => Projectile.width * StringReelbackInterpolant * 0.3f;
|
||||
|
||||
// Where the string should go, relative to the center of the projectile
|
||||
public Vector2 topStringOffset => new Vector2(-40f, -56f);
|
||||
public Vector2 bottomStringOffset => new Vector2(-40f, 46f);
|
||||
public float StringHalfHeight => (Math.Abs(topStringOffset.Y) + Math.Abs(bottomStringOffset.Y)) * 0.5f;
|
||||
|
||||
public float ChargeupInterpolant => Utils.GetLerpValue(HeavenlyGale.ShootDelay, HeavenlyGale.MaxChargeTime, ChargeTimer, true);
|
||||
|
||||
public float StringHalfHeight => Projectile.height * 0.36f;
|
||||
|
||||
public float StringReelbackDistance => Projectile.width * StringReelbackInterpolant * 0.25f;
|
||||
|
||||
public ref float CurrentChargingFrames => ref Projectile.ai[0];
|
||||
|
||||
public ref float ChargeTimer => ref Projectile.ai[1];
|
||||
|
||||
public ref float ShootDelay => ref Projectile.localAI[0];
|
||||
|
||||
public override int AssociatedItemID => ModContent.ItemType<HeavenlyGale>();
|
||||
|
||||
public override int IntendedProjectileType => ModContent.ProjectileType<HeavenlyGaleProj>();
|
||||
|
||||
public override void SetStaticDefaults() => DisplayName.SetDefault("Heavenly Gale");
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 138;
|
||||
Projectile.height = 138;
|
||||
Projectile.width = Projectile.height = 176;
|
||||
Projectile.friendly = true;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
@@ -173,7 +171,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
}
|
||||
}
|
||||
|
||||
Projectile.position = armPosition - Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.UnitY) * 36f;
|
||||
Projectile.position = armPosition - Projectile.Size * 0.5f + Projectile.velocity.SafeNormalize(Vector2.UnitY) * 44f;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation();
|
||||
Projectile.spriteDirection = Projectile.direction;
|
||||
Projectile.timeLeft = 2;
|
||||
@@ -200,16 +198,14 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
||||
Texture2D textureGlow = ModContent.Request<Texture2D>("CalamityMod/Projectiles/Ranged/HeavenlyGaleProjGlow").Value;
|
||||
Vector2 origin = texture.Size() * 0.5f;
|
||||
Vector2 drawPosition = Projectile.Center - Main.screenPosition;
|
||||
|
||||
// Draw the string of the bow. It reels back in the initial frames.
|
||||
float stringNeckOffset = 40f;
|
||||
Vector2 aimDirection = Projectile.rotation.ToRotationVector2();
|
||||
Vector2 center = Projectile.Center - aimDirection * 12f;
|
||||
Vector2 topOfBow = center + Vector2.UnitY.RotatedBy(Projectile.rotation) * StringHalfHeight;
|
||||
Vector2 bottomOfBow = center - Vector2.UnitY.RotatedBy(Projectile.rotation) * StringHalfHeight;
|
||||
Vector2 endOfString = center - aimDirection * (StringReelbackDistance + (1f - StringReelbackInterpolant) * stringNeckOffset * 0.5f);
|
||||
Vector2 topOfBow = Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation + topStringOffset.ToRotation()) * topStringOffset.Length();
|
||||
Vector2 bottomOfBow = Projectile.Center + Vector2.UnitX.RotatedBy(Projectile.rotation + bottomStringOffset.ToRotation()) * bottomStringOffset.Length();
|
||||
Vector2 endOfString = Projectile.Center - Projectile.rotation.ToRotationVector2() * (StringReelbackDistance + (1f - StringReelbackInterpolant) * 25f);
|
||||
|
||||
float chargeOffset = ChargeupInterpolant * Projectile.scale * 3f;
|
||||
Color chargeColor = Color.Lerp(Color.Lime, Color.Cyan, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 7.1f) * 0.5f + 0.5f) * ChargeupInterpolant * 0.6f;
|
||||
@@ -221,10 +217,7 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
direction = SpriteEffects.FlipHorizontally;
|
||||
rotation += MathHelper.Pi;
|
||||
topOfBow -= aimDirection * stringNeckOffset;
|
||||
}
|
||||
else
|
||||
bottomOfBow -= aimDirection * stringNeckOffset;
|
||||
|
||||
Color stringColor = new(105, 239, 145);
|
||||
Main.spriteBatch.DrawLineBetter(topOfBow, endOfString, stringColor, 2f);
|
||||
@@ -237,10 +230,11 @@ namespace CalamityMod.Projectiles.Ranged
|
||||
Main.spriteBatch.Draw(texture, drawPosition + drawOffset, null, chargeColor, rotation, origin, Projectile.scale, direction, 0f);
|
||||
}
|
||||
Main.spriteBatch.Draw(texture, drawPosition, null, Projectile.GetAlpha(lightColor), rotation, origin, Projectile.scale, direction, 0f);
|
||||
Main.spriteBatch.Draw(textureGlow, drawPosition, null, Color.White, rotation, origin, Projectile.scale, direction, 0f);
|
||||
return false;
|
||||
}
|
||||
|
||||
// The bow itself should not do contact damage.
|
||||
public override bool? CanDamage() => false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.7 KiB |
Reference in new issue
Block a user