Introduction

image

Flash and Game Development

Who Is This Book For?

What Do You Need To Use This Book?

Using the Example Games in Your Projects

What You’ll Find in This Book

The FlashGameU.com Website

When the first edition of ActionScript 3.0 Game Programming University came out, ActionScript 3.0 was new. It was so new, in fact, that most programmers were still stuck using older ActionScript 1.0 and 2.0.

But by now, most Flash developers have moved on to AS3, and they are loving the speed, reliability and logical development process. ActionScript 1.0 and 2.0 were often frustrating for game developers. They weren’t fast enough to get key tasks done, and odd bugs and unexpected behavior often slowed down production.

ActionScript 3.0 is a very different animal. You’ll find yourself developing quickly and effortlessly. Things just work, and work well. And the speed of ActionScript 3.0 will make your game design ideas work more as you imagined them.

If this is your first experience programming with Flash, consider yourself lucky that you can start using a mature high-powered programming language from the start. You’ll find that Flash and ActionScript 3.0 are great tools for making fun web-based games.

Let this book become your guide to Flash game development. I hope you enjoy learning from this book as much as I enjoyed writing it.

Flash and Game Development

In October 1995, I was excited about my future as a game developer. Macromedia had just released Shockwave, and I saw it as a way to develop games that I could distribute myself, over the Web.

Only twice since then have I seen something that has made me just as excited about game development as the original Shockwave. The next time was with the release of Shockwave 3D, and the third time was with the release of ActionScript 3.0.

Flash games have been around for a while, but always as the younger brother to Shockwave games. Shockwave was faster, more powerful, and eventually in 3D.

With ActionScript 3.0, however, Flash became equally as powerful as Shockwave. In some ways, it is more so. For instance, the Flash 10 player is on 99% of the web-browsing computers out there. Knowing that Flash 10 is almost as ubiquitous as the web browser itself empowers us as Flash game developers.

Flash with ActionScript 3.0 even plays on Linux machines. Older versions of Flash play on web television boxes, game consoles such as the Wii, and even portable devices such as smartphones and the PlayStation Portable. In time, we’ll have the Flash 9/10 player and ActionScript 3.0 on these kinds of devices, too.

You can develop both standalone and web-based versions of your games with Flash. You can even create versions for non-PC devices to run the iPhone, iPod Touch, iPad, and Android devices.

Flash with ActionScript 3.0 is a great, practical way to make small and medium-size games.

Who Is This Book For?

This book is for anyone using Flash to develop games. However, different types of developers will use this book in different ways.

Someone fairly new to both Flash and programming will be able to use this book as a next step after learning basic programming skills. A motivated fast learner might also be able to use this book to learn ActionScript 3.0 from scratch.

If you have previous experience programming with ActionScript 1.0 or 2.0, you can use this book to get up to speed on ActionScript 3.0.

However, you should try to forget most of what you know about previous versions of ActionScript. Seriously[md]ActionScript 3.0 is very different from previous versions. In fact, I consider it to be a whole new programming language.

Many Flash users already know the basics of animation and programming but want to move on to developing games. This is the core audience for the book.

If you are not a programmer at all, but a designer, illustrator, or animator, you can use the examples in this book as a framework for your own games. In other words, you can just swap out the graphics from the source file examples.

Likewise, if you already are an expert ActionScript 3.0 programmer, this book can provide a library of code for you to draw upon to make your games. No need to start from scratch.

What Do You Need To Use This Book?

Most readers will need some previous experience with Flash and programming to get the most from this book. You also need the right tools.

Prerequisite Knowledge

Readers should be familiar with the Flash CS5 environment. If you are new to Flash, run through the Flash User Guide that comes with Flash CS5 as part of the Help documentation. From inside Flash, choose Help, Flash Help or press F1. You might also want to consider a beginner’s book or online tutorial.

This book is not geared toward first-time programmers, unless you are just looking to use the examples by substituting your own graphics. Therefore, you should have some programming experience: ActionScript 1.0, 2.0, or 3.0; JavaScript; Java; Lingo; Perl; PHP; C++; or just about any structured programming language. ActionScript 3.0 is not hard to understand if you are at least somewhat familiar with variables, loops, conditions, and functions. Chapter 1, “Using Flash and ActionScript 3.0,” in fact, sums up the basic ActionScript 3.0 syntax.

If you are a programmer, but have never used Flash before, read the parts of the Flash User Guide that pertain to the Flash interface and basic drawing and animation techniques.

Software Applications

You’ll need, of course, Flash CS5 Professional or newer. You will be able to use most of this book with Flash CS3 and CS4, as long as you get the source files from the first edition, and then skip Chapter 14, which uses new CS5 technology. If you have Flash 8 or earlier, you have a version that existed before ActionScript 3.0 and cannot be used with this book.

Flash CS5 is virtually identical on Mac and Windows. The screenshots in this book were taken with the Mac version of Flash, but they should match the Windows version very closely.

Future versions of Flash will most likely continue to use ActionScript 3.0 as the core programming language. Some of the menu choices and keyboard shortcuts might change, but you should still be able to use this book. You might want to consider setting your Publish settings for the Flash 10 player and ActionScript 3.0 to ensure maximum compatibility.

I’ve been asked in the past about using this book with Flex, Flash Builder, and Flash Develop. All of these use ActionScript 3.0, so it is theoretically possible to learn the basics from this book and apply them to those alternative development environments. However, this book makes extensive use of the Flash Library and the creation of simple Flash elements such as movie clips and text fields. So, you would have to know how to rework the examples to create the games without those elements. I don’t recommend it. However, the concepts in this book might make it a useful addition to other learning materials.

Source Files

You also need the source files for this book. See the end of the Introduction for information about how to obtain them.

Using the Example Games in Your Projects

This book includes many complete games, including some gems such as Match Three, a side-scrolling platform game, and Word Search. The question I often get is this: “Can I use these games in my project?”

The answer is this: Yes, as long as you modify the games to make them your own, such as changing the artwork, game play, or other content. Posting the games as is to your website is not acceptable. Also, posting the source code or code listings from this book is unacceptable.

When you use these games in your projects, don’t try to pass them off as completely your own work. To do so would be unprofessional. Please credit the book with a link to http://flashgameu.com.

However, if you are only using a small portion of the code, or using a game as a basic framework for something very different, no attribution is needed.

Basically, just use common sense and courtesy. Thanks.

What You’ll Find in This Book

Chapter 1, “Using Flash and ActionScript 3.0,” introduces ActionScript 3.0 and some basic concepts, such as game programming strategies and a checklist to help you develop games in Flash CS5.

Chapter 2, “ActionScript Game Elements,” presents a series of short code snippets and functions, such as creating text fields, drawing shapes, and playing sounds. This is a useful and practical library of code that we’ll be using throughout the book (and you’ll be using in your own projects).

Chapters 3 through 14 each contain one or more complete games. The text of the chapter walks you through the game code, enabling you to build it yourself if you want. Or, you could use the source file and walk through the code.

Chapter 3, “Basic Game Framework: A Matching Game,” is a little different from the rest of the book. Instead of examining game code for a finished game, it builds a game in 10 steps, producing a different Flash movie and source code file with each step. It is a great way to learn how to build Flash games.

Most of the rest of the chapters introduce a special topic before starting a new game. For instance, Chapter 4 starts with an “Arrays and Data Objects” section.

But, the content of this book doesn’t stop with the pages in your hands. There is more to be found online.

The FlashGameU.com Website

FlashGameU.com is the companion website to this book. Go there to find the source files, updates, new content, and a Flash game development discussion list.

The source files for this book are organized by chapter, and then further divided into archives for each game. There is a link to download the files at the main page of FlashGameU.com.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.12.156