Updated Magma Ball sprites.

This commit is contained in:
FyloZ 2020-07-09 21:57:29 -04:00
parent 6dcf23b6c8
commit ff1ffcdfbe
3 changed files with 40 additions and 1 deletions

View File

@ -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;
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 351 B

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 B