HTML and CSS Reference
Listing 7.16. game.js—Building lasers
Step 3: Integrate laser collision detection
Collision detection in SVG Aliens requires a couple of simple steps:
1 . Collect all of the active lasers and store their DOM data.
2 . Compare their retrieved information against currently active SVG elements. If a
collision is true , then fire that object's hit method.