Macromedia Director MX 2004: Training from the Source

What You Will Learn

In this lesson you will

  • Learn how to handle keyboard input in Director

  • Learn about primary event handlers and how to use them

  • Create and use a film loop to animate the player's ship

  • Enable the player's ship to be navigated using the cursor keys

  • Learn how to handle multiple key presses

  • Create a sprite magazine to simulate a continuous stream of bullets

Approximate Time

This lesson should take you about 2 hours to complete.

Lesson Files

Media Files:

primary_event.dir

bullet.png

Starting Files:

2d_game_start.dir

key_helper_start.dir

Completed Files:

key_helper.dir

2d_game.dir

This is the second lesson in the third project, an old-style 2D Space Shooter. In this lesson you will add the player's ship to the game and create the Lingo necessary to control it using the keyboard's cursor keys.

A look at the completed game

Knowing how to poll the keyboard is an important part of your programmer's tool chest, and luckily Director makes it fairly easy to do. While there are various ways you can use Lingo to read the keyboard, we'll use a common method employed by many Director game developers: polling the keyboard within the frame's behavior script.

Категории