HTML and CSS Reference
In-Depth Information
7.3.4. Maintaining a complex SVG group
With the work in group 3, which creates your UFO flock, you need to account for 55 UFOs
(see figure 7.10 ) that dynamically move around the screen. Although it's possible to build
each one manually, that's pointless when you can program a method to do it for you. In-
stead, you'll use our code to generate your UFOs.
Figure 7.10. UFOs are not only cute; they're also an evil dominant force in numbers.
Here for your reference are the steps for this section.
• Group 3: The UFO flock
◦ Step 1: Set up the UFO flock.
◦ Step 2: Generate paths for the UFOs.
◦ Step 3: Animate the UFOs.
◦ Step 4: Make the UFOs randomly shoot.
Step 1: Set up the UFO flock
Logic for creating your UFO's placement and AI requires a lot of math. We won't pretend
it's easy, but working through the following listings will help you to understand very basic
AI programming in games. The next listing determines the number of UFOs to create,
groups those UFOs, and sets up to animate them.
 
Search WWH ::




Custom Search