tModLoader How do i make my custom projectile pierce and dissipate into dust?

Zeeks

Steampunker
Hello, i'm very new to modding and item coding and i wanted to know how to make my custom projectile pierce 5 enemy's before dissipating into a particle explosion (like how the rainbow rod does)

My current code:

Code:
using Terraria.ID;
using Terraria;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;

namespace BrilliantStarMod.Items
{
public class GalaxyShot : ModProjectile
{
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("you really should'nt be seeing this");
        }

public override void SetDefaults()
{
            projectile.width = 15;
            projectile.height = 15;
            projectile.aiStyle = 0;
            projectile.friendly = true;
            projectile.magic = true;
            aiType = ProjectileID.Bullet;
            projectile.rotation += 0.5f * (float)projectile.direction;
            projectile.penetrate = 1;
}
        public override void AI()
{
Dust.NewDust(projectile.position + projectile.velocity, projectile.width, projectile.height, 59, projectile.velocity.X * -0.5f, projectile.velocity.Y * -0.5f);
}
         public override void Kill(int timeLeft)
{
Collision.HitTiles(projectile.position, projectile.velocity, projectile.width, projectile.height);
Main.PlaySound(SoundID.Item10, projectile.position);
}
}
}
I appreciate any help you give me, even if its just a tip or some kind words, thank you!
 
You are going to want to put this: projectile.penetrate = -1; in your void set defaults spot. also, I recommend making a projectiles folder instead of using the "items" namespace.
 
Back
Top Bottom