Currently I am trying to create a lightning and make as a particle effect asset which can export and use in any fla file.
I use for loop to create my particle effect as follow:
thunderbolt = 1;
for( tb = 0; tb < thunderbolt; tb++ )
{
_root.thunderorigin.duplicateMovieClip( “thunder”+tb, d++ )
for( corethunderlifespan = 200; corethunderlifespan > 0; corethunderlifespan – )
{
randomDirection = random(2);
if( randomDirection == 0 )
{
_root[“thunder”+tb]._x += random(11);
}
if( randomDirection == 1 )
{
_root[“thunder”+tb]._x -= random(11);
}
_root[“thunder”+tb]._y += thunderspeed;
_root[“thunder”+tb].duplicateMovieClip( “corethunder”+d, d++);
}
}
However, I cannot figurte out why I cannot loop the entire for loop. Therefore I only can create one lightning on the screen. When I add one more frame in that layer, it can continuous spawn the lightnings as I wish but it is not reusable.
Can anyone tell me how can I repeat single frame again and again or how to repeat that for loop?