
Viewing one frame in a split-second, then normal animation
Back with more secretive Lua questions. More animation questions, but this time it's something specific. The idea is to flash one frame for the bare minimum time possible before continuing on at a given rate with the others. I need to do this because I want to make trees that can collide with MOs or vice versa as it grows, and flashing the last frame it sets the collision for everything before it. Otherwise the collision is set for the first (and smallest sized) frame. I'm attempting to work around by having the first frame be the fully grown tree, then the second and onwards being from small to big. When I try this code however, it just locks it on one frame, or seems to. Without the >>indicated<< bit, the plant iterates through the frames to the last one and stays there, as intended. Any ideas?
Code:
function Create(self)
self.animTimer = Timer()
self.frameChangeTime = 200 -- This is the time interval between changing frames (In miliseconds).
self.Flashframe = 1
self.startFrame = 2
self.maxFrame = 12 -- This is the frame at which you want the animation to stop at.
end
function Update(self)
>>>>if self.Frame = self.Flashframe then
self.Frame = self.startFrame
end <<<<<
if self.Frame >= self.maxFrame then
self.Frame = self.maxFrame
else
if self.animTimer:IsPastSimMS(self.frameChangeTime) then
self.Frame = self.Frame + 1
self.animTimer:Reset()
end
end
end