Flying Through Paths: MissileGame in SVG..But No curveto Explosions Yet?
Join the DZone community and get the full member experience.
Join For FreeWay back in 2004, Damien Clarke wrote the missile game 3d in Flash -- a follow-up to two other Flash games (written by his cousin) and a fun time-sink, with simple mouse control, that roughly simulates Lando's spectacular run in the second Death Star.
It's basically a geometry-heavy collision-detection game, and just as enjoyable as it sounds.
Now Ben Mather has shown his post-Flash mettle and recreated the game in SVG, taking full advantage of Kevin Lindsey's popular 2D geometry JavaScript library for SVG:
KevLinDev's library worries about intersections, projection and reflection, polygon definition, 2d point and vector routines, color picking, bezier morphing, mouse tracking, and loads of other game-geometry and game-GUI problems. And it's a great library for any SVG game development.
But Ben's MissileGame port really shows off the game library's power, and boasts some really nice, complex SVG of its own.
..including some code tantalizingly marked 'EXPLOSION!!!!' but is completely commented out..!:
<!--== EXPLOSION!!!! ========================================================--> <!-- <path id="explosion"--> <!-- transform="scale(2,2)"--> <!-- fill="#f5bd3c"--> <!-- stroke="#ff2626" --> <!-- stroke-width="0.5"--> <!-- d="m -0.63488,-4.3752--> <!-- c 0.24879,1.233, 1.1883,2.6366, 1.768,0.69037--> <!-- 0.74264,0.71431, 1.2069,0.6277, 1.6362,-0.5115--> <!-- -0.034821,1.0871, 0.096633,1.6827, 0.74401,1.7541--> <!-- -0.091757,1.4249, 0.70746,2.0783, 1.2188,1.8749-->
..plus lots more path curveto commands. (Is there an SVG explosion path generator, btw? I assume he didn't hand-tune all those x-and-y's...)
So try the game itself, first, and then look at the svg source, which points you to all the game-logic JavaScript.
And maybe see what happens if you de-comment the explosions transformation..!
Opinions expressed by DZone contributors are their own.
Comments