Get Your Digital Subscription to Game Career Guide

media partners
 
all partners


Get the latest Education e-News    
  • Excerpt: Foundation Game Design With Flash

    [12.15.09]
    - Rex van der Spuy
  • [Many student and independent projects use Adobe Flash. Here, we offer a leg up to Flash novices with this excerpt from Apress' book Foundation Game Design With Flash by Rex van der Spuy. 

    Alongside this excerpt, Apress is offering a 50 percent off coupon to members of the GameCareerGuide and Gamasutra communities. Visit http://www.apress.com/ . Once you've chosen your titles, click on the 'Buy eBook' button, enter the promotional code GAMASUTRAPP, click to apply the coupon and proceed to the checkout.] 

    So how do you make a video game? Although there are probably as many ways to make games as there are readers of this book, a good place to start is with a piece of software called Flash. Not only is Flash very easy to learn but you can also use it to produce games of great complexity and professional quality if you have time and imagination. The other great thing about Flash is that the skills you'll acquire while learning game design with Flash can be directly applied to game design on many other platforms if you want to take your learning further. Flash is a completely comprehensive software tool for building games. It's now in version 10 and is part of Adobe's Creative Suite 4 set of design software (although it can be purchased and used as an individual product).

    Learning game design with Flash is really a two- step process. You need to learn Flash's visual work and graphic design environment, and also its built- in programming language called ActionScript. A programming language is a kind of language, similar to English or French, that we humans can use to communicate with computers. To make games with Flash, the game characters and objects are designed in Flash's visual design environment and they're then told how to behave using ActionScript. The big advantage of using Flash to learn game design over other methods is that the visual design and programming elements are completely integrated. This greatly speeds up the simplicity and efficiency of the game- design process and makes it a whole lot of fun as well.

    Tens of thousands of people around the world have made a career out of designing games with Flash. With this book and a little bit of practice, you could become one of them.

    Basics you need to have

    Surprisingly, video game design can be a relatively low- tech affair. Here's the basic equipment you need:

    • A reasonably up- to-date computer, either running Windows or the latest version of Mac OS X.
    • An installed copy of Adobe Flash CS4 (version 10). You can download Flash directly from the Adobe website: www.adobe.com. Although it requires an initial investment, it's a bargain for such a powerful piece of professional software. Adobe also offers upgrades from previous versions at an extremely reasonable cost. You can try Flash for a free 30- day trial period if you want to make completely sure it's for you.

    Things you need to know

    This book assumes that you haven't had any experience using Flash-or any experience with computer programming. You'll go on a step- by-step journey through these fascinating worlds. If you want to learn to design games from scratch, this book is all you need to get started.

    That said, Flash and the ActionScript programming language are huge topics that you could easily spend a lifetime studying, and no one book will be able to provide all the answers to all the questions you might have while you're learning. If you've never used Flash before, I highly recommend that you spend a bit of time reading through the documentation and working through some of the exercises and sample projects in Adobe's online Help system. (To access them, select Help ? Flash Help from Flash's menu.) You might also find it very beneficial to spend a weekend with a good introductory book on Flash, such as one of the excellent books for Flash beginners published by friends of ED. These resources will answer some of the more basic questions that you might have about how to use Flash and what it's capable of without the added complexity of having to absorb some of the conceptual issues of game design and ActionScript programming at the same time.

    But, hey, if you want to dive into the deep end right away, I'm with you! This book is a great a place to start and is the only resource you need.

    And the things you don't need to know

    Perhaps even more enlightening is what you don't have to know to be able to make use of this book:

    • Math (not much, anyway!)
    • Computer programming
    • Graphic design
    • Website design
    • Practically anything else!

    In fact, I'll even allow you to say, "I hate computers," or let you indulge in a fantasy of hurtling a particularly heavy blunt object at your monitor. Rest assured that I have shared exactly those same feelings at some point or another!

    It's all about programming

    What most of the content of this book deals with is how to write computer programs. Computer programs are like movie scripts that tell the characters and objects in your games what they should do and how to behave under certain conditions. For example, suppose that you designed a game in which the player must use the arrow keys on the keyboard to guide a duck through a pond infested with hungry snapping turtles. How will the duck know that it must move when the arrow keys are pressed? You would need to write a program to tell the duck to do this.

    ActionScript is the name of the computer programming language that you'll be using to write the programs for your games. It's a very sophisticated and powerful language, closely related to Java. ActionScript is currently in version 3 and is known as AS3.0 for short. It's a wonderful language for learning to program because of the following:

    • It is completely integrated into Flash's graphic design environment, so you can create visually rich games much more quickly than with most other programming languages.
    • For the same reason, you can often see the results of your programs on the screen right away. This makes the experience of programming very concrete, very satisfying, and far less abstract than learning to program in many other programming languages.
    • Adobe has done a lot of work to make the experience of programming with AS3.0 extremely user friendly. It has simplified the technical hurdles to getting programs up and running as a one- click process.
    • AS3.0 is a "real" programming language like Java or C++. It's been in development for many years and complies with an open source programming language called EMCAScript. The great thing about learning to program with AS3.0 is that the skills you learn will be directly applicable to the study of other programming languages, and you'll be able to build on these skills for years to come. ActionScript is here to stay, and you can grow with it.
    • Games and programs created with AS3.0 are cross- platform, which means that they run on any computer operating system (Windows, Mac OSX, or Linux) as long as that system has Adobe's free Flash Player software installed. The Flash Player is one of most widely installed pieces of software in history, so you're guaranteed a potentially huge audience for your games without having to rewrite the programming code from scratch for each system.
    • There is a huge community of friendly AS3.0 developers on the Internet who have devoted vast amounts of time to writing tutorials and helping others in online forums and discussion boards. If you get stuck while writing a program, just ask a question on one of the many Flash and ActionScript discussion boards, and you'll surely get a helpful reply. 

    Programming? But I'm terrible at math!

    So is the author of this book! One of the biggest misunderstandings that nonprogrammers have about computer programming is that programming is some kind of math. It's not. It might look the same on the surface, and some of the syntax has been borrowed from mathematics for matters of convenience, but the whole underlying system is completely different.

    That's not to say you won't be using any math in these lessons-you will. How much? You'll use addition, subtraction, multiplication, division, and some very basic algebra (the kind you might remember from fifth grade). That's as complex as the math gets, and AS3.0 actually does all the calculating for you.

    It can get as complicated as you want it to. In a later chapter you'll use a bit of trigonometry to achieve some specific motion effects. However, you won't need to necessarily understand the mechanics of how trigonometry is achieving those effects-just how to use it in the context of your game. This book is written largely from a nonmath point of view, so mathophobes of the world are welcome!

    Although you certainly don't need to use much math to start building great games right away, acquiring a deeper understanding of the mathematical possibilities of programming with AS3.0 will definitely give you many more options as a game developer. Two very comprehensive and highly readable books that cover this area in much more detail than the scope of this book allows are Foundation ActionScript Animation: Making Things Move!, by Keith Peters; and Flash Math Creativity, by various authors. Both books are published by friends of ED and are perfect companions to Foundation Game Design with Flash. You can apply all the techniques they discuss directly to the game projects in this book.

    I already know how to program!

    This book has been written to be as accessible as possible for beginners and doesn't assume any programming background. However, many of you might be experienced programmers who are reading this book to find out how you can use your existing AS3.0 skills to create games. Don't worry; although the earlier chapters are definitely geared toward people new to Flash and ActionScript, later chapters deal with fairly advanced areas of object- oriented programming that provide quite a bit of meat for you to sink your programming teeth into.

    What I recommend is that you flip ahead to Chapter 5, which is the first chapter that uses programming techniques to build a complete game from beginning to end. If it seems a bit complex or there are some terms and concepts you don't understand, step back by a chapter or two until you find your comfort level. Otherwise, if Chapter 5 seems like a good level for you, go for it! From a programming point of view, things get quite a bit more interesting from that chapter onward.

    Many of the techniques involved in game design are quite specialized, Even though you might know quite a lot about ActionScript or programming, it's not always obvious how to use those skills to build games. The focus of this book is on the architecture of game design instead of the specific nuts and bolts of programming. If you have a lot of programming experience, this book will show you how you can use those skills within the context of completely developed games.

    Some of you might be new to Flash CS4 and AS3.0, but have used previous versions of Flash and have programmed in AS1.0 or AS2.0. To ease the transition process, this book will also point out the major differences between the new AS3.0 way of doing things and the way it used to be done in earlier versions of the language.