View unanswered posts | View active topics It is currently Thu Dec 26, 2024 5:03 pm



Reply to topic  [ 5 posts ] 
 if(actor.ClassName == MOPixel) - How would I make this work 
Author Message

Joined: Thu Apr 12, 2007 2:53 am
Posts: 83
Reply with quote
Post 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?


Thu May 21, 2009 10:16 pm
Profile WWW
User avatar

Joined: Wed Jan 14, 2009 7:12 pm
Posts: 1525
Location: In between your sister's legs, showing her how to use a... PS3 controller!
Reply with quote
Post 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.


Thu May 21, 2009 10:21 pm
Profile
User avatar

Joined: Fri Jan 26, 2007 3:22 am
Posts: 1451
Reply with quote
Post 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


Thu May 21, 2009 11:21 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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.


Thu May 21, 2009 11:37 pm
Profile

Joined: Thu Apr 12, 2007 2:53 am
Posts: 83
Reply with quote
Post 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.


Thu May 21, 2009 11:45 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 5 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.052s | 14 Queries | GZIP : Off ]