[COLOR=#333333][FONT=Verdana]Hi there, [/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]I have been doing a game scene where MC(target) will fall from the top to the bottom of the screen. I want to make these targets to be shot, each one will fall down as a loop until in a time I want then another target will fall down …may be like 1 minute each.[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]It’s ok with only 1 MC but, I wan to add others to the scene. I’m using for statement to add MC and that make a function for it to ru…like this…
[/FONT][/COLOR][COLOR=#333333]for(i=1;i<=numTarget;i++){[/COLOR]
tar=_root.attachMovie("mcTarget","t"+i,i); tar._x=random(Stage.width); tar._y=-random(Stage.height); tar._xscale=random(50)+50; tar._yscale=tar._xscale; tar.onEnterFrame=targetRun;}function targetRun(){ if(_root.tarTimetxt>=0){ this._y+=spdTarget*(this._xscale/100); if(this._y>Stage.height){ this._x=random(Stage.width); this._y=-this._height; } } if(_root.tarTimetxt>=10){ for(i=1;i<=numTarget;i++){ delete _root["t"+i].onEnterFrame; _root["t"+i].removeMovieClip(); } } [COLOR=#333333]}[/COLOR][COLOR=#333333][FONT=Verdana]
[/FONT][/COLOR][COLOR=#333333][FONT=Verdana]I have tried many ways to create another mc such as[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]I created a new scene so everything will be like fresh start but, still didn’t work very well.[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]I created another FOR in the same frame and add another function, used all different variables. a,b,c,d,…[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]So the questions are…[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]1)this for statement can be more than one in the same frame? or I can only use one, if YES then how can I add another MC to the scene.[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]2) Is there any better ways else to create thing like I want just MC which is a target to shoot fall down in a time I want ?[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana]OH! the shooting code I use is like this…
[/FONT][/COLOR][COLOR=#333333]function ballRun(){[/COLOR]
this._x+=this.spdX; this._y+=this.spdY; for(i=1;i<=numTarget;i++){ tar=_root["t"+i]; if(this.hitTest(tar)){ if(tar._currentframe==1){ tar.play(); this.removeMovieClip(); } } } [COLOR=#333333]}[/COLOR][COLOR=#333333][FONT=Verdana]
[/FONT][/COLOR][COLOR=#333333][FONT=Verdana]3) Do I have to created function sm/thg like ballRun every MC I change?[/FONT][/COLOR]
:puzzle::puzzle::puzzle:
[COLOR=#333333][FONT=Verdana]Thanks in Advance.[/FONT][/COLOR]:beam: