View unanswered posts | View active topics It is currently Thu Apr 25, 2024 4:56 pm



Reply to topic  [ 3 posts ] 
 Parent 
Author Message
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1359
Location: USA
Reply with quote
Post Parent
My problem:
Code:
   function Create(self)
   local curdist = 100;
   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 < curdist then
       curdist = dist;
       self.parent = actor;
   end
    end

   
     function Update(self)
          for actor in MovableMan.actors do
                  if actor.ID ~= self.parent.ID then  <----------
                        blah blah
                  end
          end
    end



says trying to index parent on that line, and parent is nil. Any help? Don't worry about the tabbing.


Mon Jun 08, 2009 9:23 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Parent
for actor in MovableMan.actors do

Needs to go after curdist line but before avgx and avgy.


Mon Jun 08, 2009 9:30 pm
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Parent
Along with an end statement.


Mon Jun 08, 2009 11:38 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.086s | 15 Queries | GZIP : Off ]