
Emitting only one particle instead of many
Back again with another question! This time I have something releasing seeds when it gets to a certain frame, which works as expected, except because of the way I did it the entire time it's on that frame it sprays them all over. I put an if statement there which constrains the seed creation appropriately - however, since the seeds create other instances of this, the variables seem to carry across to all of them. So one plant creates four seeds, but only one of the creates more seeds. While that's probably not bad balance-wise, that's not what I'm looking for. Is there a better way to make this emit only one than an if statement? For statements don't seem to work either.
Code:
function Create(self)
self.minframe = 0;
self.maxframe = 0;
self.growthframe = 0;
self.counter = 0;
self.lifetimer = Timer();
stop = 0;
end
function Update(self)
if self.Frame == 7 and stop == 0 then
local seed = CreateMOSRotating("Missile Seedpod","Xenobiology.rte")
seed.Pos = self.Pos + Vector(0,-20);
seed.Vel = Vector(0 + math.random(-8,8),-40);
seed.RotAngle = 0;
MovableMan:AddParticle(seed)
stop = 1
end
if self.Frame >= 10 then
self.ToSettle = true;
end
end