View Full Version : Help making duplicated enemies fire back...
Elbudster
June 21st, 2004, 02:04 PM
I'm making a game and so far everything is going good. This is what I have so far... http://webpages.charter.net/rrahlf/Game.htm
I just cannot think of a way to get the enemies to fire back. The enemies spawn on a couple second interval function which duplicates a movie clip called enemy. I somehow need to make them duplicate a different bullet movieclip.
Any ideas?
Lemme know if im being to vague :P
Dunga
June 21st, 2004, 04:00 PM
Well, I generally use attachMovie to put them into a blank filler clip. This lets you refer to them with a for ... in loop. Making a generic firing thing makes it much easier- you can just iterate through the enemies, randomly telling one to fire.
Elbudster
June 21st, 2004, 04:02 PM
Hmm could you expand on that, not quite sure what you mean :|
Dunga
June 21st, 2004, 05:19 PM
Ok... well, first you would use createEmptyMovieClip to make the blank clip. Then you would instead of duplicating a movieclip, use attachMovie to put them instead of in _root, in the blank clip. Then you would set an interval to loop through the blank movieclip with a for ... in loop, and use a random number to decide whether one will fire. Look up the for ... in loop in the flash documentation.
Edit: To make them fire, you would use the same thing as the players fire mechanism, exept you would use attachMovie, put them in thier own blank clip, and hitTest on the player.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.