How would I make part of a function update at a slower rate?
Code:
function Create(self)
end
function Update(self)
for actor in MovableMan.Actors do
local diff = math.sqrt(math.pow((actor.Pos.X-self.Pos.X),2) + math.pow((actor.Pos.Y - self.Pos.Y),2))
local ydiff = math.abs(actor.Pos.Y - self.Pos.Y)
if ydiff < -30 then
if not(actor.PresetName == "Dood") then
actor.Vel.Y = 0
end
end
if (diff < 100) and actor.PinStrength == 0 then
if (ydiff < 100) then
if not(actor.PresetName == "Dood) then
local diffx = actor.Pos.X - self.Pos.X
local diffy = actor.Pos.Y - self.Pos.Y
actor.Health = actor.Health -.2
local ang = math.atan2(diffy,diffx)
actor.Vel.Y = -1
actor.Vel.X = 0
end
end
end
end
end
Code:
actor.Health = actor.Health -.2
Here's the line that I don't want updated every time the function updates. I tried using a counter but that didn't work properly for more than one actor.