ActionScript 3.0 Design Patterns

(Chris Devlin) #1

308 | Chapter 8: Observer Pattern



  1. In the Symbol editing mode, drag a copy of thebulletmovie clip to the center
    position (X=0, Y=0).

  2. Click on Frame 20 and press the F5 key to add frames to Frame 20. Now, press
    F6 to add a keyframe. Select the keyframe in Frame 20, and move the bullet
    movie clip to X=380, Y=0.

  3. Click on Frame 1, and in the Properties panel, select Motion in the Tween menu.
    You should see an arrow in the Timeline from Frame 1 to Frame 20 with a blue
    background. When you test it, the bullet MC should move from left to right.

  4. Click on Frame 1, and open the Actions panel (Press F9 or Option + F9 on the
    Mac). Type instop( ).

  5. Repeat steps 1 through 8 for the Alien weapon. Make the Alien slug (bullet) look
    different and use the movie clip nameprojectile. Use the dimensions W=42,
    H=11. Instead of the weapon nameMissile, use the nameTorpedo. The Alien
    torpedo has to go in the opposite direction of the Earthling missile. So, from the
    initial position of X=0, Y=0 in the first frame, it should be in X=-423 for the last
    frame of the tween. Figure 8-4 shows a couple of simple magnified examples of
    the weapons.


Building the Android space station and beam


The Android space station represents an automated space station that fires a double


beam at both the Earthling and Alien ships. It’s nothing more than a pentagon-


shaped object. The v-shaped beam weapon sits on the pentagon movie clip.



  1. Select Insert➝ New Symbol from the menu bar.

  2. When the New Symbol window opens, type inAndroidin the Name window,
    and select Movie clip as the Behavior. If you see a button named Advanced, click
    it. It opens up part of the New Symbol window that you need for the next step.


Figure 8-4. Earthling and Alien weapons


Earthling’s Missle

Alien’s Torpedo
Free download pdf