Error regarding AEmitters being spawned
Well, the error message looks like this:
And the code that causes it looks like this:
Code:
function Create(self)
self.lifeTimer = Timer();
end
function Destroy(self)
if self.lifeTimer:IsPastSimMS(950) == false then
emitter = CreateAEmitter("Bullet Effects");
emitter.Pos.X = self.Pos.X;
emitter.Pos.Y = self.Pos.Y;
local totalVelocity = math.sqrt(self.Vel.X^2 + self.Vel.Y^2);
local flightAngle = math.asin(self.Vel.Y / totalVelocity);
emitter.RotAngle = flightAngle + math.pi;
MovableMan:AddParticle(emitter);
end
end
Also worth noting is that there are up to 24 instances of that code being run at the same time. The error doesn't seem to make the code malfunction, but i'm pretty sure it could end up lagging the game, as well as clogging up the Lua console.
Any idea on how to fix? (I guess it'd have something to do with making each emitter unique or something)