Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: Respawning enemies

(59 views • 3 replies)

This topic is 1 page long.

<< < > >>
None

helxliankid

Reply To Post Reply & Quote

Posted at: 5/19/08 09:38 PM

helxliankid LIGHT LEVEL 07

Sign-Up: 07/27/05

Posts: 34

Here's basically what I want: When you start, there are 5 enemies, whenever one dies, a new one spawns, once you defeat like 20 of them, they disappear, and a final boss appears. The main problem I'm having is in the beginning. I'm trying duplicate movieclip, but that only creates the initial 5 and no others once they die.

Can someone help me fulfill this task?


Questioning

PvtAntoine

Reply To Post Reply & Quote

Posted at: 5/19/08 10:07 PM

PvtAntoine NEUTRAL LEVEL 07

Sign-Up: 03/06/06

Posts: 23

I'm not sure to understand your problem but why don't you use attachMovie instead of duplicateMovieClip ?


None

helxliankid

Reply To Post Reply & Quote

Posted at: 5/19/08 10:09 PM

helxliankid LIGHT LEVEL 07

Sign-Up: 07/27/05

Posts: 34

how do you use attachmovie?

As clarification of what I want to do, I want to start with 5 enemies and as each one dies, a new one spawns so there is constantly five enemies on the screen at all times.


None

PvtAntoine

Reply To Post Reply & Quote

Posted at: 5/19/08 10:22 PM

PvtAntoine NEUTRAL LEVEL 07

Sign-Up: 03/06/06

Posts: 23

attachMovie("idName", "newName", depth);

idName = this is the name of the MovieClip in your library (right click, linkage, export for actionscript, identifier) don't forget to put the " "

newName = this is an instance name you give to each MCs ex: MyClip1

depth = you can only have one MC on each depth value, this.getNextHighestDepth() will give you the next empty depth

for (i=1; i<=5; i++){
_root.attachMovie("idName", "myclip"+i, this.getNextHighestDepth());
}

this will create 5 MCs with 5 different instances (myclip1, myclip2, myclip3, myclip4, myclip5)

for the limit of 5 enemies... try to create a variable that count the number of enemies on stage

EnemyCount = 0;

if (EnemyCount<5){
//create an enemy and add +1 to your count
}

if the count gets to five, it will stop spawning, don't forget to minus 1 each time you destroy one.

hope this helps


All times are Eastern Daylight Time (GMT -4) | Current Time: 02:02 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!