public override void SetDefaults()
 {
     npc.height          = 480;
     npc.width           = 18;
     npc.damage          = 70;
     npc.defense         = 60;
     npc.lifeMax         = 2000;
     npc.soundHit        = 21;
     npc.soundKilled     = SoundID.CreateTrackable("dd2_explosive_trap_explode", 3, SoundType.Sound);
     npc.value           = 10f;
     npc.knockBackResist = 1f;
     npc.aiStyle         = 3;
 }
예제 #2
0
        public override void Kill(int timeLeft)
        {
            Main.PlaySound(SoundID.CreateTrackable("dd2_betsy_fireball_impact", 3, Terraria.Audio.SoundType.Sound), (int)projectile.position.X, (int)projectile.position.Y); // Play a death sound
            Vector2 usePos = projectile.position;                                                                                                                            // Position to use for dusts
            // Declaring a constant in-line is fine as it will be optimized by the compiler
            // It is however recommended to define it outside method scope if used elswhere as well
            // They are useful to make numbers that don't change more descriptive
            const int NUM_DUSTS = 20;

            for (int i = 0; i < NUM_DUSTS; i++)
            {
                // Create a new dust
                Dust dust = Dust.NewDustDirect(usePos, projectile.width, projectile.height, 226);
                dust.position  = (dust.position + projectile.Center) / 2f;
                dust.velocity *= 0.5f;
                dust.noGravity = true;
            }
        }