HTML and CSS Reference
In-Depth Information
Note
Until Opera comes up with a fix, using getBBox() on an SVG element in Opera won't
work as expected.
Step 4: Make the UFOs randomly shoot
Each time your update() method is called, a shot might be fired based on a random
number check. If a UFO does shoot, you're going to use a piece of the bounding box you
generated in the previous listing to fire from one of the bottom-row UFOs. You could make
the firing more dynamic, such as only from the bottom row of each column, but that takes a
lot more logic, and this way you can use the SVG bounding box data again to speed things
up. Integrate the following listing to make your UFOs fire lasers.
Search WWH ::




Custom Search