Hi,
Saving you a boring read: **ENTER_FRAME listener to the stage, update everything else from this loop, OR individual listeners to arbitrary classes? **
Its me again, with my ridiculous questions! I’ll jump straight on the boat, when programming flash games in general, what is the best way to go about handling event listeners, say I have 30 enemies that are supposed to be moving at once, and under these enemies are quite a number of classes, all having quite specific tasks, and all need to be updated through a update/render function, I.E the A.I class would need the render/update function to figure out its next move, while the Pathing class would need to figure out its next path to take, and the graphics engine would have to draw the enemies moving… You get the drill.
What is best practice regarding events in such a case? While the A.I update should probably run on a enter_frame basis the actual moving could be limited to when the X/Y values of enemies are changing, but for this case lets say a lot of the classes needs to be run on a ENTER_FRAME basis, would it be best to register one ENTER_FRAME event to the stage, and update everything from within that loop, or registering individual ENTER_FRAME events to the concerned classes? (Naturally this means proper removal of the listeners after they’ve served their purpose). Also, please concider the X/Y value thing above, would that save any effort, or should I just apply an ENTER_FRAME listener to this aswell?
Thanks for reading