Add Energy Core sprite
This commit is contained in:
@@ -1,21 +1,54 @@
|
|||||||
using Terraria.ID;
|
using Terraria.ID;
|
||||||
using Terraria;
|
using Terraria;
|
||||||
using Terraria.ModLoader;
|
using Terraria.ModLoader;
|
||||||
|
using Terraria.DataStructures;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using ReLogic.Content;
|
||||||
|
using System;
|
||||||
|
using Terraria.GameContent;
|
||||||
using ForgottenWawiTech.Content.Rarities;
|
using ForgottenWawiTech.Content.Rarities;
|
||||||
|
|
||||||
namespace ForgottenWawiTech.Content.Items.Materials
|
namespace ForgottenWawiTech.Content.Items.Materials
|
||||||
{
|
{
|
||||||
public class EnergyCore : ModItem
|
public class EnergyCore : ModItem
|
||||||
{
|
{
|
||||||
|
private const int TICKS_PER_FRAME = 12;
|
||||||
|
private const int FRAME_COUNT = 2;
|
||||||
|
|
||||||
|
public override void SetStaticDefaults()
|
||||||
|
{
|
||||||
|
Main.RegisterItemAnimation(Type, new DrawAnimationVertical(TICKS_PER_FRAME, FRAME_COUNT));
|
||||||
|
}
|
||||||
|
|
||||||
public override void SetDefaults()
|
public override void SetDefaults()
|
||||||
{
|
{
|
||||||
Item.width = 20;
|
Item.width = 64;
|
||||||
Item.height = 20;
|
Item.height = 64;
|
||||||
Item.maxStack = 9999;
|
Item.maxStack = 9999;
|
||||||
Item.rare = ModContent.RarityType<SingularityItem>();
|
Item.rare = ModContent.RarityType<SingularityItem>();
|
||||||
Item.value = Item.buyPrice(gold: 50);
|
Item.value = Item.buyPrice(gold: 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool PreDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, ref float rotation, ref float scale, int whoAmI)
|
||||||
|
{
|
||||||
|
Texture2D texture = Terraria.GameContent.TextureAssets.Item[Type].Value;
|
||||||
|
|
||||||
|
// Protect against incorrect frame count
|
||||||
|
int frameHeight = texture.Height / Math.Max(1, FRAME_COUNT);
|
||||||
|
int frame = (int)((Main.GameUpdateCount / (ulong)Math.Max(1, TICKS_PER_FRAME)) % (ulong)Math.Max(1, FRAME_COUNT));
|
||||||
|
|
||||||
|
Rectangle source = new Rectangle(0, frame * frameHeight, texture.Width, frameHeight);
|
||||||
|
|
||||||
|
Vector2 drawPos = Item.Center - Main.screenPosition;
|
||||||
|
Vector2 origin = new Vector2(source.Width / 2f, source.Height / 2f);
|
||||||
|
|
||||||
|
// Use alphaColor for dropped items (includes item alpha), multiplied by light
|
||||||
|
Color drawColor = lightColor;
|
||||||
|
|
||||||
|
spriteBatch.Draw(texture, drawPos, source, drawColor, rotation, origin, scale, SpriteEffects.None, 0f);
|
||||||
|
|
||||||
|
return false; // we've handled the draw
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 504 B After Width: | Height: | Size: 32 KiB |
@@ -20,7 +20,6 @@ namespace ForgottenWawiTech.Content.Items.Materials
|
|||||||
public override void SetStaticDefaults()
|
public override void SetStaticDefaults()
|
||||||
{
|
{
|
||||||
Main.RegisterItemAnimation(Type, new DrawAnimationVertical(TICKS_PER_FRAME, FRAME_COUNT));
|
Main.RegisterItemAnimation(Type, new DrawAnimationVertical(TICKS_PER_FRAME, FRAME_COUNT));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetDefaults()
|
public override void SetDefaults()
|
||||||
|
|||||||
+2
-1
@@ -132,8 +132,9 @@ Stick to 32x32 to 64x64 in my opinion - however can go up/down if needed - Niko
|
|||||||
- A cylinder shaped device (sort of like Ekko's time machine) to contain singularities
|
- A cylinder shaped device (sort of like Ekko's time machine) to contain singularities
|
||||||
- [ ] Controlled Singularity
|
- [ ] Controlled Singularity
|
||||||
- See above, just with a singularity in
|
- See above, just with a singularity in
|
||||||
- [ ] Energy Core
|
- [x] Energy Core
|
||||||
- A compact, circular power source. Imagine a small, futuristic fusion reactor.
|
- A compact, circular power source. Imagine a small, futuristic fusion reactor.
|
||||||
|
- Completed by Neptune
|
||||||
- [ ] Fallen Angel Feather (dev boss material)
|
- [ ] Fallen Angel Feather (dev boss material)
|
||||||
- A feather from Noctis's wings, imbued with celestial energy.
|
- A feather from Noctis's wings, imbued with celestial energy.
|
||||||
- [x] Half Eaten Fish (dev boss material)
|
- [x] Half Eaten Fish (dev boss material)
|
||||||
|
|||||||
Reference in New Issue
Block a user