|
-
Hype over content...
pentru:
Kinda 
Yeah if you wanted 50 sprites ( mcs ) on screen at a time, then yeah you'd have 50 set up on your stage ( You'd need an 8ghz machine to run the game though ), and crashlanding is right, each mc would have all the frames you'd need for every possible baddie ( Plus explosions for them ).
Now the only code you need on them is
code:
onClipEvent(load){
gotoAndStop(1);
_visible=false;
}
So they are hidden and not bothering you.
Forget attaching script to each one, every enterFrame slows down your game, so you want as few as possible.
You'd set up a handlerMC ( I know there are better ways to go, but I'm not really up for doing a crash course on OOP I'm afriad ), and get that to loop through each mc running it's code. That way all your code is within just one mc.
Also each baddie would have a flag, let's call it currentStatus.
So:
currentStatus=0; Not active
currentStatus=1; Attacking / whatever
currentStatus=2; Dying
And possibly
currentStatus=3; Dead
You shot a baddie, you set it's flag to 2 for dying ( ie it's running it's explosion frames ). So you no longer check for a collision on it, but you can't re-cycle it yet cause it's still exploding. Once the explosion is complete you hide that sprite again and it's free for the game to use again.
Hope that's a bit clearer, if it's not, just ask mate.
ballofsnow:
Further to jbum's good points, another way to do it would be to give each bullet it's own function pointer, eg
var bulletFunc1=null;
var bulletFunc2=null;
etc.
So when bullet1 is fired, you change it's pointer to bulletFunc1=shooting ( Where shooting is your bullet handling function ).
Then in your main enterFrame, just put
bulletFunc1();
etc.
So each bullets function is called every frame.
Squize.
Squize.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|