macromedia DIRECTOR MX 1002004 training from the source [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

macromedia DIRECTOR MX 1002004 training from the source [Electronic resources] - نسخه متنی

Dave Mennenoh

نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
افزودن یادداشت
افزودن یادداشت جدید

Creating a Film Loop

First of all let's discuss what exactly a film loop is, and why you might use one in your projects. A film loop is simply a discrete section of the Score, containing one or more sprites, that is turned into single cast member. That cast member can then be placed back into the Score, as a single sprite. Any animation in the original sprites will still be present in the film-loop sprite.

Originally, film loops were used to combine multiple sprites into a single sprite to save score channels. Now that there are 1000 channels available this is no longer necessary. In Director 5, however, where there were only 48 sprite channels, this technique could break that barrier.

A Bouncing Ball

One example of a film loop that I like to show is that of a bouncing ball. This is because a bouncing ball is actually not the simplest thing to key frame by hand, but is easy with a film loop. Using a film loop you can break down the animation into its discrete parts: the up-and-down motion and the horizontal motion.

1.

Select File > New > Movie, then set the Stage size to 800x600 with a black background.

2.

In the tool palette, choose a nice bright color, such as yellow, and create a filled circle on the Stage.

TIP

Hold the Shift key down while creating the circle to lock the aspect ratio and create a perfect circle.

The circle's size is irrelevant, but don't make it too large. Something like this is just fine:

[View full size image]

3.

Change the sprite's span length so that it ends at frame 20. Right-click at frame 10 in the span and choose Insert Keyframe from the context menu. Right-click again at frame 20 and choose Insert Keyframe again. The sprite span will look like the following:

4.

Single-click the key frame at frame 10 to select it. Hold down the Shift key and press the up arrow ten or twelve times to move the sprite up about 100 pixels. Press play to observe the motion.

As expected, the circle now moves up and down in a straight line.

5.

Stop the movie and single-click the sprite span at frame 10 to select the entire span. Choose Insert > Film Loop. In the Create Film Loop dialog give the film loop the name Bouncy, then press OK.

When you press OK a new Film Loop cast member appears in the internal cast.

The film loop contains the sprite and its animation from the Score, and can replace the sprite that is currently there.

6.

Delete the sprite in the Score and drag the new film loop cast member onto the stage. Drop it near the left edge of the Stage. Modify the sprite's span so that it goes from frame 1 to 60. Right-click the sprite at frame 60 and choose Insert Keyframe. Finally, drag the sprite on Stage to the right edge of the screen while holding down the Shift key.

The film loop will now move from left to right over the course of 60 frames while it plays the animation of the ball moving up and down, giving the illusion of a moving bouncing ball.

7.

Play the movie to observe the results.

The ball now bounces alongand demonstrates how breaking down an animation into its separate components can make complex motions easy to simulate.

Now let's get back to the gameat last!

Adding the Player's Ship

In this section you'll create a film loop for the player's ship to animate its engine exhaust and make the ship appear to be flying.

1.

Open the 2d_game file from your project_three folder, or open 2d_game_start from the Lesson12 folder on the CD. Click in the Score's frame bar at frame 110.

We'll use an empty section of the movie to create the ship's film loop.

2.

From the assets cast drag the ship1 cast member into the Score and drop it so its span begins at frame 110. Adjust the span so it ends at frame 120.

This will be the first of three sections for the animation, with each one being 10 frames long. Dragging the ship to the Score, instead of the Stage, places the sprite in the exact center of the stage, making it simple to align the three ships.

3.

Drag ship 2 from the assets cast into the Score and drop it so that its span begins at frame 121. Adjust it so it ends at frame 131, taking up 10 frames.

4.

Drag ship 3 from the assets cast and drop it in the Score so that its span begins at frame 132. Adjust it so it ends at frame 142.

You can now select all three sprites and turn them into a single, animated film loop that can be moved around the screen as a single sprite.

5.

Select all three sprites in the Score and choose Insert > Film Loop. Name the film loop ship_loop.

Because the assets cast was active, the new film loop appears in the next empty position. You can either delete the sprites used to make the film loop or leave them in the Score. Deleting them will not affect the film loop member. Typically, I like to leave them in place though so that if I need to modify the film loop I can delete it, and recreate it, without having to place all of the sprites again.

6.

Single-click to select frame 10 of channel 20 in the Score, then drag the ship_loop cast member onto the Stage. Position the ship near the left edge of the screen. Modify the sprite's span so that it goes from frame 10 to frame 25.

Once you've got the ship sprite in place, you can copy it to the other two sections of the movie. Doing this insures the ship will start where you intended, at the beginning of each new level.

7.

Single click the ship's sprite to select it and press Ctrl/Command+C to copy it. Single-click in the Score at frame 30 of channel 20 and press Ctrl/Command+V to paste in the sprite. Finally, single-click at frame 50 of channel 20 and paste the sprite once more.

Note that if you placed more than 15 asteroids in level 3 you won't have channel 20 free to paste the ship into. If that is the case simply delete any asteroids past channel 19. You now have the player's ship in all three levels.

8.

Rewind and play the movie.

The player's ship now has an animated exhaust and appears to actually be flying. The next step is adding keyboard control so that the ship can be moved about the screen.

9.

Stop the movie, then single-click the ship sprite to select it. In the Property inspector give the ship sprite the name player.

Later on, when you add the bullets, you'll need to reference the ship sprite in order to place the bullets at the nose of the ship. Giving the sprite a name will allow you to do this without having to hard-code a sprite channel.

10.

Save the movie before continuing. Be sure and save it as 2d_game into your project_three folder.

/ 165