Re: Short circuiting in Lua
Code:
function Create(self)
self.box = Box(Vector(self.Pos.X - 85, self.Pos.Y - 65), Vector(self.Pos.X + 85, self.Pos.Y + 70));
end
function Update(self)
self.Scale = 1;
for actor in MovableMan.Actors do
if self.box:WithinBox(actor.Pos) == true then
self.Scale = 0.001;
end
end
end
Works perfectly.
The self.Health was just because I wasn't sure if I'd want to publicly demonstrate the actual purpose I had in mind.
As it happens, I'm not really bothered. It's an interesting effect, but of questionable usefulness.