10.12.2012 Views

ActionScript 3.0 Design Patterns.pdf - VideoTutorials-bg.com

ActionScript 3.0 Design Patterns.pdf - VideoTutorials-bg.com

ActionScript 3.0 Design Patterns.pdf - VideoTutorials-bg.com

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5. In the Symbol editing mode, drag a copy of the bullet movie clip to the center<br />

position (X=0, Y=0).<br />

6. Click on Frame 20 and press the F5 key to add frames to Frame 20. Now, press<br />

F6 to add a keyframe. Select the keyframe in Frame 20, and move the bullet<br />

movie clip to X=380, Y=0.<br />

7. Click on Frame 1, and in the Properties panel, select Motion in the Tween menu.<br />

You should see an arrow in the Timeline from Frame 1 to Frame 20 with a blue<br />

background. When you test it, the bullet MC should move from left to right.<br />

8. Click on Frame 1, and open the Actions panel (Press F9 or Option + F9 on the<br />

Mac). Type in stop( ).<br />

9. Repeat steps 1 through 8 for the Alien weapon. Make the Alien slug (bullet) look<br />

different and use the movie clip name projectile. Use the dimensions W=42,<br />

H=11. Instead of the weapon name Missile, use the name Torpedo. The Alien<br />

torpedo has to go in the opposite direction of the Earthling missile. So, from the<br />

initial position of X=0, Y=0 in the first frame, it should be in X=-423 for the last<br />

frame of the tween. Figure 8-4 shows a couple of simple magnified examples of<br />

the weapons.<br />

Figure 8-4. Earthling and Alien weapons<br />

Building the Android space station and beam<br />

The Android space station represents an automated space station that fires a double<br />

beam at both the Earthling and Alien ships. It’s nothing more than a pentagonshaped<br />

object. The v-shaped beam weapon sits on the pentagon movie clip.<br />

1. Select Insert ➝ New Symbol from the menu bar.<br />

2. When the New Symbol window opens, type in Android in the Name window,<br />

and select Movie clip as the Behavior. If you see a button named Advanced, click<br />

it. It opens up part of the New Symbol window that you need for the next step.<br />

308 | Chapter 8: Observer Pattern<br />

Alien’s Torpedo<br />

Earthling’s Missle

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!