Foundation Game Design With Actionscript 3.0 2nd Edition ...

hihatcloverΛογισμικό & κατασκευή λογ/κού

4 Ιουλ 2012 (πριν από 5 χρόνια και 1 μήνα)

229 εμφανίσεις

Foundation Game Design With Actionscript 3.0 2nd
Edition - Table of Contents
Table of Contents
About the Author………………………………………………………………...xiii
About the Technical Reviewer………………………………………………...xiv
About the Cover Image Designer……………………………………………..xv
Acknowledgements…………………………………………………………….xvi
Introduction…………………………………………………………………..…xvii
Chapter 1
:

Programming Foundations: How To Make A Video Game……… ..1
Basic requirements
1. A computer
2. Graphic design software
3. Computer programming software
Adobe Flash Professional
Things you need to know
And the things you don’t need to know
It’s all about programming
Programming? But I’m terrible at math!
I already know how to program!
What kind of games can I make?
Learning new terms
Laying the foundation
Using Flash Builder
Setting up the work environment in Flash Builder
Writing your first program
ActionScript files and the .as file extension
I’ll take that to go!
A little magic with sprites
Don’t skip class!
Using the constructor method
Aligning code
What’s your directive?
Adding comments to your code
Running your program and compiling the SWF file
What happened when you compiled the program
*It didn’t work?
Some common error messages
Confirm your program with the original source files
*More about Flash Builder
Editing window quirks and features
Perspectives
*A little more about AS3.0 and the Flash Player
*Naming conventions
Summary
Chapter 2: Making Game Graphics
Create a game world background
Create a new file in Photoshop
Draw the sky
Drawing hills
Drawing with the pen tool
Duplicating, modifying, and arranging layers
Bevel and emboss
Making boxes with the rectangular selection tool
*Making a game character
Create a new file
Draw your character
*Making buttons
Create a new file
Draw the button
Using the type tool
Making more buttons .... 115
Save your work and make the PNG files ...... 117
Checking your work...... 118
More about Photoshop ..... 119
Summary ...... 120
Chapter 3: Programming Objects
But I’m a bit scared of programming!
Loading and displaying images
Setting up a new AS3.0 project
Understanding the setup file
Set up the Flash Player with a metadata tag
Loading and displaying the background.png image
How did that work?
Variables
Variable types
Creating empty boxes
Creating instances and objects
Displaying the image on the stage
Understanding the code structure
Positioning Sprites on the stage
Programming buttons
Understanding dot notation ....... 159
Methods ........ 159
Using method calls ....... 160
Using function definitions ...... 161
Using a basic method ....... 163
Understanding events and event listeners ... 168
Making your buttons work ..... 177
Controlling Sprite objects with properties..... 178
Going up and down ....... 180
Moving incrementally ....... 182
Tracing the output ..... 183
Using increment and decrement operators ...... 184
Limiting movement ........ 185
Making it bigger and smaller ..... 189
Vanishing! ..... 192
Spinning around ........ 195
More properties? ....... 198
Centering Sprites ..... 198
Code summary ..... 202
*Summary ....... 206
Chapter 4: Decision Making ....... 209
Using text ..... 210
Setting up the project .... 210
The classes you have to import .... 212
Creating TextFormat and TextField objects ..... 213
Setting the format of text ....... 214
Configuring and displaying the output text ... 216
Configuring and displaying the input field ..... 218
Building a simple guessing game .... 222*
Understanding the program structure ... 222*
Learning more about variables .... 224
Listening for key presses ...... 227
Making decisions ...... 231
Displaying the game status ....... 238
Using postfix operators to change variable values by one .. 240
Tying up strings..... 241
Hey, why use the gameStatus variable, anyway? .... 245
Using uint vs. int variables .... 245
Winning and losing ....... 246
Modular programming with methods .... 252
Polishing up ...... 253
Tackling random numbers .... 254
Disabling the Enter key ..... 258
Making really nice buttons ....... 260
Understanding the concepts ..... 262
Loading the images and displaying the button ..... 263
Understanding the mouse events ..... 265
Adding the button to the number guessing game .... 271
Disabling the button at the end of the game ..... 272
Managing complex code ....... 278
Project extensions ........ 279
Make a Play again button ..... 279
Tracking guesses ...... 280
Adding a visual display ..... 281
Turning the tables ..... 281
A quick guide to embedding fonts .... 281
Summary ...... 284
Chapter 5: Controlling A Player Character ... 285
Controlling a player character with the keyboard..... 285
Controlling with the keyboard---the wrong way! ... 286
Controlling the keyboard---the right way! ...... 290
Moving with velocity ...... 292
Using the new keyDownHandler ....... 294
Using the keyUpHandler ....... 294
Using the enterFrameHandler ...... 296
Setting stage boundaries ...... 298
Blocking movement at the stage edges.... 298
Screen wrapping ....... 303
Embedding images ...... 304
Scrolling ....... 307
Looking at the code ...... 310
Better scrolling ...... 313
Even better scrolling ..... 320
Taking it further ........ 323
Parallax scrolling ....... 324
Summary
Chapter 6: Bumping Into Things ... 331
Basic collision detection with hitTestObject ...... 331
Using hitTestObject ...... 335
Triggering a change of state .... 337
Reducing a health meter ....... 341
Using scaleX to scale the meter based on a percentage ..... 343
Updating a score ....... 344
Picking up and dropping objects ....... 351
The bad news about hitTestObject ...... 357
Detecting collisions with the bounding box ... 358
Learning to live with it ....... 359
Creating subobjects ...... 360
Advanced collision detection strategies .... 364
Working with vector based collision detection ..... 365
Preventing objects from overlapping .... 365*
Programming with the Collision class ... 373*
Another look at methods, arguments, and parameters ..... 378
Taking a look at the Collision.block method ..... 381
Summary ...... 387
Chapter 7: Making Games ...... 389
Making the game graphics ....... 390
Making the textured box ....... 391
Making the bomb ...... 407
Making a game character ..... 416
Designing the playing field .... 429
Making the Game Over graphic .... 430
Programming the game ....... 432
Dealing with many objects .... 432
What is a class, really? ..... 434
Looking at the TimeBombPanic application class .... 439
Adding objects to the game ...... 444
Stage boundaries ...... 446
Collisions between the character and the boxes ...... 447
Defusing the bombs ...... 447
Using a timer ..... 448
Ending the game ....... 453
Creating a scrolling game environment ... 456
Preparing your artwork for scrolling ...... 457
Adding objects to the game ...... 458
Scrolling and stage boundaries .... 460
*Summary ...... 463
Chapter 8: Making Bigger Games ..... 465
Understanding the game structure ....... 466
Using private variables and methods ... 469
Programming the game ....... 471
Giving LevelOne access to the stage ... 471
Making sure that LevelOne is actually on the stage ..... 472
The LevelOne class ...... 475
Programming the game character .... 482
Programming the monsters ...... 489
Programming the star weapon ...... 495
Checking for the end of the level ...... 503
Ending the level ........ 505
Using removeChild to completely get rid of objects ...... 513
Communicating between classes by dispatching events ..... 514
Event bubbling ...... 516
Finishing off level one ....... 518
Firing stars in four directions in level two ..... 519
More Monster Mayhem! ....... 522
Moving objects in a scrolling game world ..... 522
Intelligent monsters ....... 537
Obstacles and pathfinding .... 540
A little more about game structure ....... 541
Summary ...... 543
Chapter 9: Physics, Loops, Arrays, and Sounds ..... 545
Natural motion using physics ....... 545
A game object class for playing with physics ... 546
Acceleration ...... 548
Friction ...... 555
Bouncing ....... 557
Gravity ....... 559
Jumping ........ 561
Adding sounds to games ..... 567
Integrating sound effects in a game ..... 569
Looping music and setting volume and pan levels ... 570
Working with many objects ...... 575
Using arrays ...... 580
Making many boxes ...... 589
Collisions with many objects ..... 596
Case studies ..... 603
Summary ...... 604
Chapter 10: Advanced Object And Character Control .... 605
Moving objects with the mouse .... 606
Fixing an object to the mouse’s position ... 606
Moving an object with easing .... 607
Case study: Firing projectiles in all directions ...... 613
Making the game objects ...... 617
Rotating the wand around the fairy ....... 618
Firing stars in 360 degrees ....... 620
Advanced player control systems .... 623
Enemy AI systems ....... 624
Running away from the player ...... 627
Rotating and shooting toward the mouse ..... 628
Using a timer to fire bullets ....... 631
Case study: Killer Bee Pandemonium! .... 632
Flash animation and publishing your game ...... 640
Index ... 643