Forum Topic: Question!!

(115 views • 2 replies)

This topic is 1 page long.

<< < > >>
Resigned

Wampo

Reply To Post Reply & Quote

Posted at: 9/8/08 12:51 PM

Wampo FAB LEVEL 10

Sign-Up: 12/14/06

Posts: 17

I haf a Kooastchan... err I have a question!
Is it possible to make 2 functions or somethin at once.. i cant explain.. ..
i try an example:

timer += 1;
if (timer == maxtime){
duplicateMovieClip(thing,"thong"+i, i);
timer =  0;
} 

is it possible to make the duplicate twice if timer == maxtimer and three times if timer == maxtimer again?
like:

timer += 1;
if (timer == maxtime){
duplicateMovieClip(thing,"thong"+i, i) *= 2;
timer =  0;
} 

lol, i think thats wrong :P

Did you know Wampo is a river in south africa?
Unbelieveble :O


None

Murudai

Reply To Post Reply & Quote

Posted at: 9/8/08 06:08 PM

Murudai FAB LEVEL 09

Sign-Up: 04/15/08

Posts: 371

Generally when doing duplicates you stick them in a for loop.

But with just two, it would be less lines just to copy and paste the code onto a new line, so you have it twice. Not the best practice, but at least it's clearer to read :)

Murudai: Indie Game Developer
I make Xbox 360 games. And the odd Flash game.
Website: http://murudai.com/

BBS Signature

None

deadlock32

Reply To Post Reply & Quote

Posted at: 9/8/08 06:38 PM

deadlock32 NEUTRAL LEVEL 18

Sign-Up: 04/28/01

Posts: 2,502

just as murudai says:

// init
var totalThong = 1;
////

timer += 1;
if (timer == maxtime){

  for(var thongIndex = 0; thongIndex < totalThong; thongIndex++)
  {
     duplicateMovieClip(thing,"thong"+thongIndex, thongIndex)
  }

  totalThong++;
  timer =  0;
} 

All times are Eastern Standard Time (GMT -5) | Current Time: 11:05 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!