HTML and CSS Reference
In-Depth Information
Step 3: Generate random enemy properties
With your polygon's 3D data built, you need to generate speed, rotation, color, and a
spawning point so it functions properly. Append
randomMeta()
and
cube()
methods
to
gd.template.Polygon
with the next listing.
Listing 9.25. run.js—Polygon shape
init()
prepend
Step 4: Resolve enemy collisions
The last step to create the
gd.template.Polygon
requires you to add methods for
generating shape data from a random side and cube particles when it's destroyed. You