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

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

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

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

Dave Mennenoh

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


اندازه قلم

+ - پیش فرض

حالت نمایش

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

Adding a Camera Backdrop

A camera backdrop is a bitmap imagea texture actuallythat gets placed behind all your 3D models. Using a backdrop is a good way to simulate such things as far-off trees and buildings, or the sky. It's also a simple way to add a background to a three-dimensional world, which is what we're going to do with the memory game.


Import bluegradient.png from the Lesson17\media folder on the CD. You can import it as 24 bits, as it has no alpha channel.

This image will serve as our background, behind the game board. Textures that are used for backdrops don't get scaled; the image is 800 x 600 in size to make sure it covers the area completely.


Right-click the 3D sprite and select Script from the context menu. Add the following two lines of code to the beginSprite handler. You can add the lines at the bottom of the handler:

bb = wrld.newTexture("blueback", #fromCastMember, member("bluegradient")), point(0,0), 0)

You can actually add the code anywhere in the handler so long as you add it after the resetWorld() method is called. If you add it before resetWorld() then the second time the game is played you will receive an error when you try to create a texture that already exists.

First, a new texture named blueBack is created from the blueGradient cast member. A reference to the texture is stored in bb, and then used in the following line, which adds the texture to the camera's list of backdrops. (As this implies, you can have multiple backdrops, but you won't be using that feature here.)

Let's examine the line that adds the backdrop:, point(0,0), 0)

Remember, each 3D sprite shows a view of the 3D world through a particular camera and since sp is a reference to the 3D sprite, this adds the backdrop to the current view. The first parameter you pass in is, of course, a texture reference. Next, you specify the location of the backdrop's upper left corner. Because you want the image to fill the camera's view, point (0,0) will place the image at the top left. The final parameter specifies the rotation of the backdrop and because you don't want the gradient rotated, a 0 is passed in.


Rewind and play the movie.

When the movie plays, the gradient now appears behind the game board, and looks better than the simple black that was there previously.


Stop the movie and save it before continuing.

The game is now fully playable and could be made into a projector, or placed online in a Web page. But before you do that, I suggest you look through the next section for some ideas on making the game even better.

Ideas to Try

While the memory game is quite playable, and even fun, there is much that could be done to improve it.

Following are some thoughts and ideas that I might do to improve this game.

Sound Adding sound effects, such as when cards are flipped, when they flip back, when all matches are made, etc., would be fun.

Speed At 30 fps, the cards may rotate a little slowly. You could try setting the game's tempo higher, or even increase the rate of interpolation.

Game Intro An intro screen with a cool graphic, instructions, and a start button, is a good idea.

More Game If you have access to a 3D package, you might consider making a bigger playing board: 4 x 5, or even 6 x 6 if you're really feeling smart.

You might even try making an entirely new kind of memory game where you don't flip cards over. Maybe you don't flip anything…

That's it for this project and, of course, this book. I sincerely hope that you learned a good deal about Director in reading and working your way through it.

/ 165