Re: Animating Emitters based on Velocity
As of build 23, Lua scripts cannot be run on attachables (including emitters that are attached to objects). You can put the scripts on the parent object, though. The script would be something like this:
Code:
function Create(self)
self.makeframe = 0;
self.emitterlist = {};
for i = 1,MovableMan:GetMOIDCount()-1 do
attachable = MovableMan:GetMOFromID(i);
if attachable.PresetName == "AEmitter Name" and attachable.ClassName == "AEmitter" and attachable.RootID == self.RootID then
self.emitterlist[#self.emitterlist+1] = attachable;
end
end
end
function Update(self)
if self.Vel.Magnitude < 10 then
self.makeframe = 0;
elseif self.Vel.Magnitude => 10 and self.Vel.Magnitude < 20 then
self.makeframe = 1;
end
for i = 1, #self.emitterlist do
if self.emitterlist[i].ID ~= 255 then
self.emitterlist[i].Frame = self.makeframe;
end
end
end
What this does is that it finds AEmitters that are attached it when it is created, and then changes their frame according to the scripted object's velocity. Also, be sure to change the SpriteAnimMode so the emitters can't animate on their own and allow the script to do it.