Game Development Reference
This method is called every time a new bullet is created, which is every time the player presses the
spacebar. It's lq^he_ so that outside classes such as >qhhap can access it. The actual instance names
of the bullets will be different, but that doesn't matter because the method refers to them all as
^qhhap. The great thing about this system is that it all happens without you needing to know the actual
instance names of the bullets themselves. You could have one bullet or 1000, and the code remains
The collision-detection code is very straightforward. When the bullets hit the enemies, they're removed
from the stage, and the width of the enemies' health meters are reduced by ten pixels. If the width of
the meters becomes less than one pixel, the enemies are removed from the stage.
After the enemy and bullet objects are removed from the stage, the references to them are also
assigned a jqhh value, like this:
Assigning a jqhh value to variables that reference objects ensures that Flash will remove the object
from the Flash Player's memory.
As it did before, the code needs to first check whether ajaiuKja and ajaiuPsk actually exist on the
stage by using this check:
The code generates errors if the enemy has already been removed and the code can't find it.