Foundation Game Design with ActionScript 3.0, Second Edition (3 page)

BOOK: Foundation Game Design with ActionScript 3.0, Second Edition
10.18Mb size Format: txt, pdf, ePub
ads

If you're using Photoshop, read through the documentation and work through some of the exercises and sample projects in Adobe's online help system. (To access them, select Help
Photoshop Help from Photoshop's menu.)

If you're using GIMP with the GIMPshop plug-in, you can follow any tutorials intended for Photoshop. A good place to start is Adobe's “Getting Started” tutorial site, which contains many helpful videos on basic Photoshop use. Go to

www.adobe.com/support/photoshop/gettingstarted/

A web search for “Photoshop tutorials for beginners” will also turn up a voluminous trove of tutorial sites, too numerous to mention here, but many of which are excellent.

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
  • Web site design
  • Graphic 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

Most of the content of this book is about how to write computer programs. Apart from a brief introduction on how to make simple game graphics using Photoshop and Illustrator, I'm going to leave it to you to explore the graphics and illustration side of game design, which is well covered in other resources.

So what is a computer program?

A computer program is like a movie script that tells 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 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 Builder and Flash Develop, which means you can often see the results of your code 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, the creator of AS3.0, 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++. 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 well as mobile platforms like iOS and Android, as long as that system has Adobe's free Flash Player software installed. This is a huge benefit because it means you only need to learn one technology, Flash, rather than several. Flash and AS3.0 are currently the only technologies that allows you to publish to all these platforms without requiring you to learn anything new. 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 its style 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 you don't have to any of that math yourself. You just need to know how to tell AS3.0 to do it for you. It's just like using a calculator.

But it certainly can get more complicated if you want it to. In later chapters 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 non-math point of view, so mathophobes of the world are welcome!

Note: 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.

If you are already a programmer, I recommend that you flip ahead to
Chapter 4
, 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 if 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 4
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.

What kind of games can I make?

This book is about how to make two-dimensional action, adventure, and arcade games; it also touches on puzzle and logic games. Flash is a fantastic medium for creating these types of games. Each chapter guides you through every step of the design process, but the projects are very open-ended and encourage you to come up with your own original ways of using the techniques in your own games.

This book excludes 3D games because 3D is a large topic that deserves a whole book in its own right. The great thing is that most of the game design techniques you learn in the context of 2D, particularly how
games are structured, can be applied directly to 3D games with little or no modification. To simplify the learning process and make sure the material is as focused and clear as it can be, however, I decided to stick to 2D games.

Learning new terms

Like any large specialized field, programming comes with a lot of new terminology to learn. This book will try to sidestep as much of the jargon as possible in favor of slightly longer and concrete descriptions. However, some terminology is so widely used that you should make an effort learn it because it may inhibit your further learning from other sources if you don't. This book will explain all new terms in the text.

Laying the foundation

As a game developer, you can think of yourself as an architect. All buildings of any size or shape have some fundamental things in common: they all have a foundation, walls, and a roof. No matter how big or small, humble or grand your house is, you need to dig a foundation, erect some walls, and put up a roof. After that you can start the really fun stuff: designing the interior layout, doing the landscaping, buying the furniture, and throwing a housewarming party.

Over the course of the rest of this chapter, you'll write a very simple program that will lay the foundation for all the games and programs you'll be creating in the rest of the book. If you haven't done any programming before or are just starting to get a grip on AS3.0, this chapter is for you.

If you have prior programming experience, you might want to jump ahead to the end of the chapter to see how much of the technical and conceptual material looks familiar. Make sure that you become acquainted with the structure you'll be using to build your games and programs, but feel free to skip this chapter if it all looks pretty straightforward.

In a tip-of-the hat to the history of computer programming, you'll write a program called a
Hello World program
. It is traditionally the first program that novice programmers write when learning a new programming language because it's the simplest complete program that can be written. It does something very simple; it just outputs the words “Hello World! Can you read this?” That's all!

The program might seem modest, but you will achieve two very important things by learning to write it.

  • You'll build a robust and flexible system for programming that will become the core of all the projects in this book and probably hold you in good stead with your own projects for years to come.
  • You'll complete a crash course in programming with AS3.0 that will lay the foundation for some of the very important concepts and techniques covered in later chapters.

Scared of programming? Ha! Not you! In this chapter, you'll grab the programming beast by the horns and wrestle it to the ground!

Using Flash Builder

Flash Builder is a comprehensive piece of software for writing AS3.0 programs and making Flash games. The next few sections will walk you through some of the basics of how to set it up and use it so that you have a solid basis for programming your games for the rest of the book.

If you are using a version of Flash Builder that came bundled with Adobe's Creative Suite 5.5, be aware that it's afflicted with a quirky bug. Flash Builder needs the debug version of the Flash Player software to show you whether there are any problems with your programs and to display special messages called
trace output
. The debug version of the Flash Player is installed automatically when you install Adobe Creative Suite, but some for strange reason, Flash Builder sometimes can't find it when you try to run your programs. Instead you'll get a message saying, “Installed Flash Player is not a debugger.”

The solution to this is to uninstall the current version of the Flash Player, and then re-install the special debug version. To uninstall the current version, you need a special Flash Player uninstaller that you can download from Adobe's web site.

You can find Flash Player uninstaller for Windows at

http://kb2.adobe.com/cps/141/tn_14157.html

You can find Flash Player uninstaller for Mac OSX at

http://kb2.adobe.com/cps/909/cpsid_90906.html

Once you've uninstalled the current Flash Player, quit Flash Builder and your web browser if they are running, and then download and install the latest debug version of the Flash Player, which you'll find at

www.adobe.com/support/flashplayer/downloads.html

If you encountered this problem while working on a project, copy all your code from Flash Builder's code editing window, and paste it into a new ActionScript project with a new name. Everything should then work just fine.

BOOK: Foundation Game Design with ActionScript 3.0, Second Edition
10.18Mb size Format: txt, pdf, ePub
ads

Other books

STARGATE SG-1 29 Hall of the Two Truths by Susannah Parker Sinard
Watchlist by Jeffery Deaver
Outcast by C. J. Redwine
On the Hunt by Alexandra Ivy, Rebecca Zanetti, Dianne Duvall
To Have and to Hold by Deborah Moggach
Dog Medicine by Julie Barton
Flirting With Maybe by Wendy Higgins
King's Shield by Sherwood Smith