Data Realms Fan Forums
http://45.55.195.193/

if(actor.ClassName == MOPixel) - How would I make this work
http://45.55.195.193/viewtopic.php?f=73&t=14844
Page 1 of 1

Author:  Erahgon [ Thu May 21, 2009 10:16 pm ]
Post subject:  if(actor.ClassName == MOPixel) - How would I make this work

Code:
if(actor.ClassName == MOPixel)
                        actor.Lifetime = actor.Lifetime*1.05
          end



I'm not sure if I have the argument right, but how can I get something like this to work?

Author:  Flammablezombie [ Thu May 21, 2009 10:21 pm ]
Post subject:  Re: if(actor.ClassName == MOPixel) - How would I make this work

an actor can't be an MOPixel if I am correct in thinking the laws of CC variable names still apply in Lua.

Author:  Daman [ Thu May 21, 2009 11:21 pm ]
Post subject:  Re: if(actor.ClassName == MOPixel) - How would I make this work

If ClassName returns the class name, and you're running for actor in MovableMan.Particles, you just need to make MOPixel a strnig.

Code:
if (actor.ClassName == "MOPixel") then return end

Author:  Grif [ Thu May 21, 2009 11:37 pm ]
Post subject:  Re: if(actor.ClassName == MOPixel) - How would I make this work

Though you really shouldn't do "for actor in MovableMan.Particles" because that's bad variable naming (which I guess I will adress in lua lesson 2).

Also, lifetime is in MS, do you really need hundredths of milliseconds? Because CC doesn't know the difference.

Author:  Erahgon [ Thu May 21, 2009 11:45 pm ]
Post subject:  Re: if(actor.ClassName == MOPixel) - How would I make this work

Grif wrote:
Though you really shouldn't do "for actor in MovableMan.Particles" because that's bad variable naming (which I guess I will adress in lua lesson 2).

Also, lifetime is in MS, do you really need hundredths of milliseconds? Because CC doesn't know the difference.



I need it for things with low lifetimes like bullets, so they don't just disappear when they are slowed down considerably.

And thanks Daman, that works perfectly.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/