tModLoader My PC thinks "ModProjectile" doesn't exist

GalaxyS29

Terrarian
I am new to Terraria modding and wanted to make something cool for a change. I wanted to spice up TModLoader's Basic Sword and make it fire a melee projectile. From what I have read up on, my code should be correct but it seems that an error pops up every time. From what I know, my computer doesn't recognize "ModProjectile" in "Terraria.ModLoader" for some reason. The sword DID work with "ModItem" though. Any help would be greatly appreciated!

My code:
C#:
using System;
using System.ComponentModel;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.ModLoader.content;

namespace tutorialmod.Projectiles
{

    public class TutorialBeam : ModProjectile
    {
        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Tutorial Beam");
        }

        public override void SetDefaults()
        {
            projectile.name = "Tutorial Beam";
            projectile.width = 20;
            projectile.height = 58;
            projectile.friendly = true;
            projectile.melee = true;
            projectile.tileCollide = true;
            projectile.penetrate = 30;
            projectile.timeLeft = 200;
            projectile.light = 0.75f;
            projectile.extraUpdates = 1;
            projectile.ignoreWater = true;
        }
    }
}

If you need the specific error:
error CS1061: 'Projectile' does not contain a definition for 'name' and no accessible extension method 'name' accepting a first argument of type 'Projectile' could be found (are you missing a using directive or an assembly reference?)
 

Attachments

  • Annotation 2020-08-08 164253.png
    Annotation 2020-08-08 164253.png
    31 KB · Views: 87
Oh my goodness. I did what you told me and it only didn't work because it didn't know what "ModLoader.content" was. It definitely works now, thank you so much for replying!
 
Back
Top Bottom