Nicht aus der Schweiz? Besuchen Sie lehmanns.de
AdvancED Game Design with Flash - Rex Van Der Spuy

AdvancED Game Design with Flash (eBook)

eBook Download: PDF
2010 | 1st ed.
808 Seiten
Apress (Verlag)
978-1-4302-2740-3 (ISBN)
Systemvoraussetzungen
39,99 inkl. MwSt
(CHF 38,95)
Der eBook-Verkauf erfolgt durch die Lehmanns Media GmbH (Berlin) zum Preis in Euro inkl. MwSt.
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Creating games in Flash is a never-ending journey of exploration, learning, and most of all, fun. Once you've mastered the basics, a new world is opened up to you, enabling you to take your existing skills to the next level and discover new skills that will in turn open new doors. This book is a direct continuation of Foundation Game Design with Flash, and is a complete point-by-point roundup of the most important skills a Flash game designer needs to know. You'll increase your ActionScript knowledge and your game design skills while creating some excellent example games. You'll learn advanced collision detection skills; professional AI and pathfinding; and how to load and save game data, create destructible environments, and build and switch game levels. 

  • Each chapter highlights a new advanced technique illustrated by practical examples.
  • Examples of games are given in a variety of genres, all of which take an object-oriented programming approach.
  • Advanced game design topics are covered, including vector-based collision reaction, pathfinding, billiard ball physics, and modeling game data.


Rex van der Spuy is a video game designer and writer. He s written Foundation Game Design with Flash, Advanced Game Design with Flash and Foundation Game Design with AS3.0. Rex has designed games and done interactive interface programming Agency Interactive (Dallas), Scottish Power (Edinburgh), DC Interact (London), Draught Associates (London), and the Bank of Montreal (Canada). He also builds game engines and interactive interfaces for museum installations for PixelProject (Cape Town). In addition, he created and taught advanced courses in game design for the Canadian School of India (Bangalore, India). When not writing about games, making them, or playing them, he amuses himself by building experimental, autonomous, self-aware, multi-cellular parallel universes out of shoe boxes, scotch tape, spare milk bottle caps and bits of string . He claims, that this is a lot more entertaining than you might think, but we re skeptical.
Creating games in Flash is a never-ending journey of exploration, learning, and most of all, fun. Once you've mastered the basics, a new world is opened up to you, enabling you to take your existing skills to the next level and discover new skills that will in turn open new doors. This book is a direct continuation of Foundation Game Design with Flash, and is a complete point-by-point roundup of the most important skills a Flash game designer needs to know. You'll increase your ActionScript knowledge and your game design skills while creating some excellent example games. You'll learn advanced collision detection skills; professional AI and pathfinding; and how to load and save game data, create destructible environments, and build and switch game levels. Each chapter highlights a new advanced technique illustrated by practical examples. Examples of games are given in a variety of genres, all of which take an object-oriented programming approach. Advanced game design topics are covered, including vector-based collision reaction, pathfinding, billiard ball physics, and modeling game data.

Rex van der Spuy is a video game designer and writer. He s written Foundation Game Design with Flash, Advanced Game Design with Flash and Foundation Game Design with AS3.0. Rex has designed games and done interactive interface programming Agency Interactive (Dallas), Scottish Power (Edinburgh), DC Interact (London), Draught Associates (London), and the Bank of Montreal (Canada). He also builds game engines and interactive interfaces for museum installations for PixelProject (Cape Town). In addition, he created and taught advanced courses in game design for the Canadian School of India (Bangalore, India). When not writing about games, making them, or playing them, he amuses himself by building experimental, autonomous, self-aware, multi-cellular parallel universes out of shoe boxes, scotch tape, spare milk bottle caps and bits of string . He claims, that this is a lot more entertaining than you might think, but we re skeptical.

Title page 1
Copyright page 2
Contents at a Glance 4
Table of contents 5
About the Author 13
About the Technical Reviewer 14
About the Cover Image Designer 15
Acknowledgments 16
Introduction 17
Enter the labyrinth! 17
Things you need to know 17
What about math? 19
Things you need to have 19
What kind of games will we make? 20
How to read this book 21
The files you’ll need 22
Setting up your work environment 23
Organizing the project folder 23
FLAs and metadata for Flash Professional 24
Using the class library 25
Setting the path to the class library 25
Packages and namespaces 26
Using SWC Files 28
Testing the class library installation 29
Optimizing the code 31
About the code 32
Code format conventions 32
Public properties or getters and setters? 35
Layout conventions 37
Chapter 1 Modeling Game Data 38
Verlet integration 39
The problem with Euler integration 40
Understanding Verlet integration 41
Using Verlet integration 42
Using the main application class 50
Importing the classes 52
Positioning the _player object 52
Figuring out the new velocity, checking collisions, and moving the player 52
Testing the system 54
Onward to Planet X! 55
Revving the Verlet velocity engine 55
Moving the spaceship 58
Introducing the Model-View-Controller Pattern 59
Understanding MVC 60
MVC in action 62
The view 65
The controller 66
The model 67
MVC your way 67
An MVC player and map view example 69
The PlayerModel 71
The PlayerView 73
The PlayerController 77
The MapView 78
The PlayerMVC application class 80
Verlet + MVC + physics = fun! 81
Making stars 84
Moving stars 85
A crash course in the drawing API 86
Drawing lines 87
Drawing squares 87
Drawing circles 89
Adding filters 90
Gradient fills 91
Complex shapes 94
Drawing the ship 94
Drawing the ship’s thruster flame 95
Add both shapes to a container sprite 96
Using drawPath for really complex shapes 98
Introducing interfaces 101
Summary 103
Chapter 2 Vectors: Ghosts in the Machine 104
What are vectors? 105
Vector characteristics 106
The x and y components 107
Vector magnitude 109
Calculating the angle 110
Vector normals 112
Normalizing vectors 115
Using and viewing vectors 117
Creating the vector model 117
Creating the vector view 124
Let’s see what those vectors look like! 124
Updating the vector each frame 127
Rotating text 128
Rounding numbers to a specific number of decimal places 130
Adding and subtracting vectors 131
Scaling vectors 133
Gravity in action 137
Real gravity 142
Projecting vectors 142
Are the vectors pointing in the same direction? 144
DragHandle objects 145
Scaling a vector object’s view 146
The VectorMath class 146
Projection in action 147
Using vector projection for environmental boundaries 150
Intersection 152
Finding the intersection point 153
Intersection in action 155
Collision and bounce 158
Collision on one side of the line 159
Getting the vector magnitude and orientation 161
Detecting a collision 162
Resolving the collision 166
Bounce 172
Momentum 175
Solid objects 176
Collision on both sides of the line 178
Bounce, friction, and gravity 183
A crash course in embedding assets 188
Embedding fonts 188
Embedding images 190
Important vector formulas 192
Create vectors 192
Vector magnitude 193
Vectors and angles 193
Left and right normals 193
Normalized vectors (unit vectors) 193
Scaling vectors 194
Gravity 194
Dot product 195
Projection 195
Define an environmental boundary 195
Resolve a collision with a vector 195
Bounce 196
Friction 197
Summary 197
Chapter 3 Collisions Between Circles 198
Abstract classes 199
Understanding abstract and concrete classes 199
Creating and implementing abstract classes 203
Creating an abstract Verlet motion class 203
Creating an abstract view class 209
Creating a concrete CircleView class 211
Keyboard and mouse control 213
Collision-handling basics 218
Collisions between moving and stationary circles 218
Collision between a circle and a line 224
Finding the point of contact 225
Finding the edge of the line 230
Collision between moving circles 239
Multiple-object collision 248
Fast-moving circles 252
Summary 258
Chapter 4 Collisions Between Polygons 259
The separating axis theorem 260
Understanding SAT 260
Using SAT 261
An SAT limitation 267
Finding the amount of overlap 268
Finding the collision side 270
Rectangle collisions 273
Rectangle collision handling in action 274
Bounce and friction 278
Triangle collisions 280
SAT with triangles—the wrong way 282
SAT with triangles—the right way 283
Triangle collision handling in action 286
Make the shapes 287
Plot the hypotenuse as a vector 287
Create a distance vector between the centers of the objects 288
Project the distance vector onto the hypotenuse’s normal 289
Project the square onto the hypotenuse’s normal 290
Create a gap vector between the square and hypotenuse 295
Find the dot product 295
Check if the shapes are overlapping 296
Move the square out of the collision 297
Triangle collision wrap-up 297
Oriented bounding box collisions 298
Polygon and circle collisions 303
Circle and square collisions 304
Circle and triangle collisions 312
Left-facing triangles 318
Case studies 319
Case study 1: Polygon environment 319
Handling slopes 321
Building game worlds 322
Case study 2: Block Game 322
MVC saves the day again! 323
The application class 325
The GameModel 326
The GameView 328
The GameController 330
Plotting the grid of blocks 336
Multilevel games 337
Summary 339
Chapter 5 Pixel-Perfect Collision and Destructible Environments 340
Vector vs. bitmap graphics 341
Using bitmaps 343
Bitmap collisions 344
Checking for a collision 345
The problems with bitmap collision 349
Finding the collision boundary 350
Bitmap collision-detection strategies 355
Convex shapes 356
Creating bitmaps from sprites 356
Creating the asteroid bitmap 358
Collision with the asteroid 359
Inside out 362
Surfaces 363
Concave shapes 365
A really huge cave 372
Scrolling 374
The mini-map 375
The map marker 379
Adding objects to scrolling environments 379
Using two-dimensional arrays 380
Creating and adding the objects 384
Scrolling the objects 385
Building a rotating gun turret 386
Drawing and rotating the cannon 387
Firing bullets 390
Moving and removing bullets 392
Destroying things! 392
Bitmap collision using points 394
Erasing the bitmap 395
Jagged rocks 397
Summary 400
Chapter 6 Explosions, Blitting, and Optimization 402
A simple particle explosion 403
Using timer events for animation 404
Creating the Explosion class 406
Dynamic properties 409
Adding and removing explosions 410
A more realistic explosion 413
Taking a snapshot 414
Slicing and dicing 419
Tiles, tile sheets, and grids 421
Making the bitmap explosion 423
Starburst explosions 431
Fast particle explosions 436
Introducing bit-block transfer 436
Basic blitting 439
How fast is fast? 451
Calculating the frame rate and memory usage 451
MovieClip vs. copyPixels 454
To blit or not to blit? 456
Blit explosions 459
Lookup tables 464
An Explosion Controller 469
Smoke trails 473
The Perlin noise effect 473
Smoke trail optimization 477
Summary 479
Chapter 7 Make It Fun! Sound, Music, and AI 480
Put fun first 481
Sound effects and music 482
Adding sound effects 483
Playing music 486
Playing and pausing 488
Restarting music 490
Fast-forwarding and rewinding 490
Changing the volume and speaker panning 491
Looping music 494
Using sound and music in a game 495
Finding sound effects and music 497
Buttons 498
Creating simple buttons 498
Making custom buttons 499
Enemy AI: Line of sight 502
Chasing the player 511
Case study: Escape! 512
Structure: your best friend and worst enemy 514
Creating a simple helper class 516
Structuring Escape! 518
Managing game screens 519
Delaying the game-over screen 523
Multiple views of the game data 524
New enemy AI techniques 526
Lying in wait 526
Traveling along a fixed path 531
Managing game states 533
Now make your own game! 535
Summary 536
Chapter 8 Tile-Based Game Design 537
Tile-based game advantages 538
Building the game world 539
Making tiles 539
The tile sheet 539
Tile sheet coordinates 541
Making a map 542
Describing the map with a two-dimensional array 544
Creating the tile model 546
Putting the map in the game 549
Blitting tiles 555
Reviewing the Map application class 558
Adding a game character 562
Layering maps 563
Making the game character move 566
Jumping 567
Moving with the mouse 568
Blitting a moving character in a tile-based world 571
Platform collision 572
Understanding spatial grid collision 574
Finding the corners 576
Applying a spatial grid to platform collision 580
Working with round tiles 588
Adding more interaction 589
Adding soft platforms 589
Adding elevators 592
Collecting objects 596
Wind them up and let them loose! 600
Squashing enemies 604
Blit animations 607
Longer blit animations 612
Movie clips vs. blitting for animation 612
Switching levels 613
Blit scrolling 619
Adding a camera 621
Establishing game world coordinates 622
Using sprites in a tile-based world 624
Blitting the tile into a sprite 626
Creating the car’s control system 629
Stuck in the grass 632
Storing extra game data in arrays 633
Creating the AI car 637
Controlling the AI car 638
Collision maps 639
Understanding dynamic spatial grids 640
Updating a dynamic grid 641
Creating a collision map 645
Other broad-phase collision strategies 654
Summary 655
Chapter 9 Pathfinding 656
Moving through a maze 657
Centering game objects 658
Moving and changing direction 659
Moving Button Fairy 660
Changing direction 664
Random movement in a maze 666
Finding an intersection 667
Changing direction 670
Chasing 675
Tile-based line of sight 680
Finding the shortest path 688
Understanding A* 689
Calculating costs 690
Finding the second step 693
Linking the nodes through their parents 700
A* in code 700
Creating a node map 701
The complete AStar class 702
Using the AStar class 709
Understanding heuristics 713
Rounding corners 717
Walking the path 718
Extending and customizing A* 721
Variable terrain 721
Influence map 721
Dijkstra’s algorithm 722
Summary 722
Chapter 10 XML and External Data 723
Local shared objects 724
Creating and loading shared objects 724
Using shared objects 725
Limitations of local shared objects 730
Loading and saving files to a specific location 731
Loading the file 732
Saving the file 734
Understanding XML 736
The building blocks of XML 736
XML hierarchy 738
XML and ActionScript 741
Creating XML objects 742
Reading elements, text nodes, and attributes 743
Reading attributes 744
Looping through elements and attributes 745
Finding all the child elements 746
A better way to find what you’re looking for 750
Changing XML data 751
Adding new elements and attributes 752
Building XML documents from existing variables 754
Removing nodes from XML documents 755
Loading game levels from XML data 756
Creating a game level map 757
Loading and interpreting the XML map data 758
Creating multiple game levels with XML 762
Loading XML files at runtime 773
Using URLLoader to load files 773
Runtime loading security issues 774
Problems loading files locally 775
Problems loading files remotely 776
Are we there yet? 777
3D games 777
2D physics 777
Online multiplayer games 778
Further reading 779
Where to next? 779
Index 780

Erscheint lt. Verlag 28.12.2010
Zusatzinfo 808 p.
Verlagsort Berkeley
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Grafik / Design
Informatik Software Entwicklung Spieleprogrammierung
Mathematik / Informatik Informatik Theorie / Studium
Mathematik / Informatik Informatik Web / Internet
Schlagworte ActionScript • Adobe Flash • Collision Detection • Modeling • music • object-oriented programming • Optimization • pathfinding • programming
ISBN-10 1-4302-2740-0 / 1430227400
ISBN-13 978-1-4302-2740-3 / 9781430227403
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 10,1 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich