Frosty Toast
Terrarian
I've been working on learning some of the basics for coding in mods, and I have successfully been able to spawn a projectile and have it do damage. However, this projectile does not move or shoot when I swing the sword; it merely sits stationary.
Any insights on things on things I can add or code I can tweak?
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace ExampleMod.Projectiles
{
public class BeetleShot : ModProjectile
{
public override void SetDefaults()
{
projectile.damage = 500;
projectile.width = 20;
projectile.height = 28;
projectile.friendly = true;
projectile.melee = true;
projectile.tileCollide = true;
projectile.penetrate = 2;
projectile.timeLeft = 200;
projectile.light = 0.75f;
projectile.extraUpdates = 1;
projectile.ignoreWater = true;
}
public override void AI()
{
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
}
}
}
Any insights on things on things I can add or code I can tweak?
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace ExampleMod.Projectiles
{
public class BeetleShot : ModProjectile
{
public override void SetDefaults()
{
projectile.damage = 500;
projectile.width = 20;
projectile.height = 28;
projectile.friendly = true;
projectile.melee = true;
projectile.tileCollide = true;
projectile.penetrate = 2;
projectile.timeLeft = 200;
projectile.light = 0.75f;
projectile.extraUpdates = 1;
projectile.ignoreWater = true;
}
public override void AI()
{
projectile.rotation = (float)Math.Atan2((double)projectile.velocity.Y, (double)projectile.velocity.X) + 1.57f;
}
}
}