| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: May 2001
Posts: 33
|
I have a basic space shooter as created from a tutorial on flashkit. The same enemy is randomly duplictated over and over again. Is there some code that will allow me to stop this duplication?
The code on the enemy is onClipEvent (load) { function reset () { this._x = 600; this._y = random(100)+50; enemySpeed = random(4)+1; this.gotoAndStop(1); } reset(); } onClipEvent (enterFrame) { if (_root.spaceship.scrollStart) { this._x -= enemySpeed+_root.mainGround.groundSpeed; } else { this._x -= enemySpeed; } if (this._x<-10) { reset(); } if (this.hitTest(_root.spaceship)) { _root.gotoAndStop("gameOver"); } } Thanks Dave |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Nov 2000
Location: Australia
Posts: 8,612
|
that code doesn't control the duplication... you'll have to edit the code which does... please use [ code ] and [ /code ] tags for forum neatness when possible.
__________________
Cheers Jesse Stratford ActionScript.org Cofounder Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org Please don't email or PM me Flash questions, that's what the Forums are for! ![]() Please don't rely on me reading my PMs either. Email me about important stuff. |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: May 2001
Posts: 33
|
sorry i think this may be it. It is contained on the first frame of the main timeline
Code:
numEnemy=3;
for (i=2; i<=numEnemy; i++){
enemy1.duplicateMovieClip( "enemy"+i, i+100 );
}
|
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2000
Location: Australia
Posts: 8,612
|
yeah that's the duplicate code but it only makes 1 (or maybe 2) duplicate(s)... if more are being made there must be more script which is looping back to that frame...
__________________
Cheers Jesse Stratford ActionScript.org Cofounder Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org Please don't email or PM me Flash questions, that's what the Forums are for! ![]() Please don't rely on me reading my PMs either. Email me about important stuff. |
|
|
|
|
|
#5 |
|
Registered User
Join Date: May 2001
Posts: 33
|
this code is what duplicates and loops the movie clip i followed it from a tutorial at
http://www.flashkit.com/tutorials/Ga...11/more4.shtml thanks dave |
|
|
|
|
|
#6 |
|
Administrator
Join Date: Nov 2000
Location: Australia
Posts: 8,612
|
I'm going to bed now and in them orning I only answer new threads since I last looked, do me a favour and reply this thread so it's considerred new when I wake up
![]()
__________________
Cheers Jesse Stratford ActionScript.org Cofounder Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org Please don't email or PM me Flash questions, that's what the Forums are for! ![]() Please don't rely on me reading my PMs either. Email me about important stuff. |
|
|
|
|
|
#7 |
|
Registered User
Join Date: May 2001
Posts: 33
|
k
|
|
|
|
|
|
#8 |
|
Registered User
Join Date: May 2001
Posts: 33
|
i have worked out i need some way to stop this duplicating happening but how?
|
|
|
|
|
|
#9 |
|
Registered User
|
Did you already considered a Stop action after the loop ?
if not stop, then make it with a variable which loops it once, then set the variable to another number and then it stops looping. like this: ( not in actionscript, but the wat it should be ) if myvar = 0 loop the duplicate action, then set myvar to 1 and it should stop bye JJ |
|
|
|
|
|
#10 |
|
Registered User
Join Date: May 2001
Posts: 33
|
thanks for all your help i have now fixed my problems
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Card Match Game, Colour Me In Pictures and Board Game | Total Frigging | ActionScript 2.0 | 4 | 02-21-2005 01:04 AM |
| word search game with AS2 | black | General Chat | 5 | 08-12-2004 10:44 AM |
| [AS2] Tile game or not tile game? | krolben | Gaming and Game Development | 4 | 07-28-2004 01:41 PM |
| Game - freelancer required | fatherb | Projects and Positions | 6 | 07-18-2003 12:47 PM |