Lets say I am working on some basic shooting game that involves lots of moving enemies. The enemies all come from one class that extends movieclip.
I want the enemies to move 10px downwards every frame. At the moment I know of two ways of doing this:
The first is to run a single onEnterFrame function on the main timeline, this function loops through all of the enemies on the screen calling a function in the enemy class that contains “x+=10”.
The second is to put the onEnterFrame function inside the constructor function of the enemy class that would then contain the “x+=10”.
Both give the same result but is one less work for the computer than the other? The first has a big loop that accesses all of the enemies, the second has an “onEnterFrame” running for each of the enemies.
Thanks, Jeff