This content has been marked as final. Show 6 replies
if you're using flash 8, enable the cacheAsBitmap property your enemy movieclips.
thanks, i never knew about that property. I think the reason it was running so slow though, was that the computers at school, the ones I was testing it on are just really really horrible, and they don't even have flash player 9 which i've heard does a much better job managing resources? Anyways, i ran the same code on my home computer and I could get up to 400 enemies on screen at once with minimal slowdown. But I just wanted to make sure I'm using this right as well as deleting my onEnterFrame properly. I'm still fairly new at actionscript and even though i'm not getting any errors, I dont really know of any way to check if the last 2 lines of code in my ewalk() function are doing anything. Heres my updated code.
Also, I found this method of adding a sprite onto the screen that seems to work and does everything I want it to, but i'm not quite sure how it works. Can anyone explain it to me? It was this line...
enemy = attachMovie(esprite, "enemyMan", _root.getNextHighestDepth());
the first block of code will be a better way to do what you're trying. the 2nd block is much more efficient (only one loop), and is really what you should be using:
i'm not sure what you're trying to do with that delete enemy.onEnterFrame, but that surely can't be what you want to do.
you should use the 2nd block of code and you should remove enemy movieclip references from enemyA when the movieclip's are no longer needed.
awesome! Thanks so much. I've got one more question though... I want my player to face the mouse, but for my game i've chosen a camera angle similar to starcraft, where it's a birds eye view, but on an angle. I've created a seperate movie clip for each angle that you would see the character on, but what I was wondering is would it be faster to create one movie clip with the different angles inside of it and instead of using attachMovieClip() to change the image when he's turning, use gotoAndPlay() instead?
there's probably not a significant difference in those two approaches.