Re: Creating a blast when certain pair of buttons is pressed.
Quote:
"root" can't be used as a variable.
Since when??
I have been using root as a variable in all my scripts and haven't had any problems with it?
and yes, you only need to find the actor, to use the script it it still useful to find the gun to get gun position and rotangle if you are making lua bullets?
else this will suffice
Code:
function Create(self)
for actor in MovableMan.Actors do
local avgx = actor.Pos.X - self.Pos.X;
local avgy = actor.Pos.Y - self.Pos.Y;
local dist = math.sqrt(avgx ^ 2 + avgy ^ 2);
if dist < 50 then
self.parent = actor;
end
end
end
function Update(self)
if self.parent ~= nil then
if self.parent:GetController():IsState(Controller.PIE_MENU_ACTIVE) then
local Ge = CreateMOSRotating("Blast");
MovableMan:AddMO(Ge);
Ge.pos = self.pos;
Ge.vel = self.Vel
self.ToDelete = true;
end
end
end