CreateProjectile on the fly
Is it possible to create a projectile by passing in the relevant information?
I am trying to get the 'PetShoot.cs' to work and I have completely fixed it, the only thing that remains is replacing the 'AreaBlasts' with an actual projectile similar to prod.
It definitely has something to do with the function 'CreateProjectile'
I have tried the follow,
Anyone know where the problem is? 
I am trying to get the 'PetShoot.cs' to work and I have completely fixed it, the only thing that remains is replacing the 'AreaBlasts' with an actual projectile similar to prod.
It definitely has something to do with the function 'CreateProjectile'
Code:
ProjectileDesc desc = new ProjectileDesc(XElement elem);
Code:
XElement prj_xml = new XElement("Projectile", new XElement("ObjectId", "Green Blob"), new XElement("Damage", 0), new XElement("Speed", 55), new XElement("LifetimeMS", 1900));
//<Projectile>
//<ObjectId>Green Blob</ObjectId>
//<Damage>0</Damage>
//<Speed>55</Speed>
//<LifetimeMS>1900</LifetimeMS>
//</Projectile>
ProjectileDesc desc = new ProjectileDesc(prj_xml);
double startAngle = Math.Atan2(host.Y - en.Y, host.X - en.X);
Position prjPos = new Position { X = host.X, Y = host.Y };
Projectile prj = host.CreateProjectile(
desc, host.ObjectType, Power, time.tickTimes,
prjPos, (float)startAngle);
host.Owner.EnterWorld(prj);
byte prjId = prj.ProjectileId;
host.Owner.BroadcastPacket(new ShootPacket
{
BulletId = prjId,
OwnerId = host.Id,
Position = prjPos,
Angle = (float)startAngle,
Damage = (short)Power,
BulletType = (byte)desc.BulletType,
AngleInc = 0,
NumShots = 1,
}, null);

