Home Page Icon
Home Page
Table of Contents for
About the Technical Reviewer
Close
About the Technical Reviewer
by Rex van der Spuy
AdvancED Game Design with Flash
Copyright
About the Author
About the Technical Reviewer
About the Cover Image Designer
Acknowledgments
Introduction
Enter the labyrinth!
Things you need to know
What about math?
Things you need to have
What kind of games will we make?
How to read this book
The files you'll need
Setting up your work environment
Organizing the project folder
FLAs and metadata for Flash Professional
Using the class library
Setting the path to the class library
Packages and namespaces
Using SWC Files
Testing the class library installation
Optimizing the code
About the code
Code format conventions
Public properties or getters and setters?
Layout conventions
1. Modeling Game Data
1.1. Verlet integration
1.1. The problem with Euler integration
1.1.2. Understanding Verlet integration
1.1.3. Using Verlet integration
1.1.4. Using the main application class
1.1.4.1. Importing the classes
1.1.4.2. Positioning the _player object
1.1.4.3. Figuring out the new velocity, checking collisions, and moving the player
1.1.4.4. Testing the system
1.1.5. Onward to Planet X!
1.1.5.1. Revving the Verlet velocity engine
1.1.5.2. Moving the spaceship
1.2. Introducing the Model-View-Controller Pattern
1.2.1. Understanding MVC
1.2.2. MVC in action
1.2.2.1. The view
1.2.2.2. The controller
1.2.2.3. The model
1.2.3. MVC your way
1.2.4. An MVC player and map view example
1.2.4.1. The PlayerModel
1.2.4.2. The PlayerView
1.2.4.3. The PlayerController
1.2.4.4. The MapView
1.2.4.5. The PlayerMVC application class
1.2.5. Verlet + MVC + physics = fun!
1.2.5.1. Making stars
1.2.5.2. Moving stars
1.3. A crash course in the drawing API
1.3.1. Drawing lines
1.3.2. Drawing squares
1.3.3. Drawing circles
1.3.4. Adding filters
1.3.5. Gradient fills
1.3.6. Complex shapes
1.3.6.1. Drawing the ship
1.3.6.2. Drawing the ship's thruster flame
1.3.6.3. Add both shapes to a container sprite
1.3.6.4. Using drawPath for really complex shapes
1.4. Introducing interfaces
1.5. Summary
2. Vectors: Ghosts in the Machine
2.1. What are vectors?
2.1.1. Vector characteristics
2.1.1.1. The x and y components
2.1.1.2. Vector magnitude
2.1.2. Calculating the angle
2.1.3. Vector normals
2.1.4. Normalizing vectors
2.2. Using and viewing vectors
2.2.1. Creating the vector model
2.2.2. Creating the vector view
2.2.3. Let's see what those vectors look like!
2.2.3.1. Updating the vector each frame
2.2.3.2. Rotating text
2.2.3.3. Rounding numbers to a specific number of decimal places
2.3. Adding and subtracting vectors
2.3.1. Scaling vectors
2.3.2. Gravity in action
2.3.3. Real gravity
2.4. Projecting vectors
2.4.1. Are the vectors pointing in the same direction?
2.4.1.1. DragHandle objects
2.4.1.2. Scaling a vector object's view
2.4.1.3. The VectorMath class
2.4.2. Projection in action
2.4.3. Using vector projection for environmental boundaries
2.5. Intersection
2.5.1. Finding the intersection point
2.5.2. Intersection in action
2.6. Collision and bounce
2.6.1. Collision on one side of the line
2.6.1.1. Getting the vector magnitude and orientation
2.6.1.2. Detecting a collision
2.6.2. Resolving the collision
2.6.3. Bounce
2.6.4. Momentum
2.6.5. Solid objects
2.6.6. Collision on both sides of the line
2.6.7. Bounce, friction, and gravity
2.7. A crash course in embedding assets
2.7.1. Embedding fonts
2.7.2. Embedding images
2.8. Important vector formulas
2.8.1.
2.8.1.1. Create vectors
2.8.1.2. Vector magnitude
2.8.1.3. Vectors and angles
2.8.1.4. Left and right normals
2.8.1.5. Normalized vectors (unit vectors)
2.8.1.6. Scaling vectors
2.8.1.7. Gravity
2.8.1.8. Dot product
2.8.1.9. Projection
2.8.1.10. Define an environmental boundary
2.8.1.11. Resolve a collision with a vector
2.8.1.12. Bounce
2.8.1.13. Friction
2.9. Summary
3. Collisions Between Circles
3.1. Abstract classes
3.1.1. Understanding abstract and concrete classes
3.1.2. Creating and implementing abstract classes
3.1.2.1. Creating an abstract Verlet motion class
3.1.2.2. Creating an abstract view class
3.1.2.3. Creating a concrete CircleView class
3.2. Keyboard and mouse control
3.3. Collision-handling basics
3.3.1. Collisions between moving and stationary circles
3.3.2. Collision between a circle and a line
3.3.2.1. Finding the point of contact
3.3.2.2. Finding the edge of the line
3.3.3. Collision between moving circles
3.4. Multiple-object collision
3.5. Fast-moving circles
3.6. Summary
4. Collisions Between Polygons
4.1. The separating axis theorem
4.1.1. Understanding SAT
4.1.2. Using SAT
4.1.2.1. An SAT limitation
4.1.2.2. Finding the amount of overlap
4.1.2.3. Finding the collision side
4.2. Rectangle collisions
4.2.1. Rectangle collision handling in action
4.2.2. Bounce and friction
4.3. Triangle collisions
4.3.1. SAT with triangles—the wrong way
4.3.2. SAT with triangles—the right way
4.3.3. Triangle collision handling in action
4.3.3.1. Make the shapes
4.3.3.2. Plot the hypotenuse as a vector
4.3.3.3. Create a distance vector between the centers of the objects
4.3.3.4. Project the distance vector onto the hypotenuse's normal
4.3.3.5. Project the square onto the hypotenuse's normal
4.3.3.6. Create a gap vector between the square and hypotenuse
4.3.3.7. Find the dot product
4.3.3.8. Check if the shapes are overlapping
4.3.3.9. Move the square out of the collision
4.3.4. Triangle collision wrap-up
4.4. Oriented bounding box collisions
4.5. Polygon and circle collisions
4.5.1. Circle and square collisions
4.5.2. Circle and triangle collisions
4.5.3. Left-facing triangles
4.6. Case studies
4.6.1. Case study 1: Polygon environment
4.6.1.1. Handling slopes
4.6.1.2. Building game worlds
4.6.2. Case study 2: Block Game
4.6.2.1. MVC saves the day again!
4.6.2.2. The application class
4.6.2.3. The GameModel
4.6.2.4. The GameView
4.6.2.5. The GameController
4.6.2.6. Plotting the grid of blocks
4.7. Multilevel games
4.8. Summary
5. Pixel-Perfect Collision and Destructible Environments
5.1. Vector vs. bitmap graphics
5.2. Using bitmaps
5.3. Bitmap collisions
5.3.1. Checking for a collision
5.3.2. The problems with bitmap collision
5.3.3. Finding the collision boundary
5.4. Bitmap collision-detection strategies
5.4.1. Convex shapes
5.4.1.1. Creating bitmaps from sprites
5.4.1.2. Creating the asteroid bitmap
5.4.1.3. Collision with the asteroid
5.4.1.4. Inside out
5.4.2. Surfaces
5.4.3. Concave shapes
5.4.3.1. A really huge cave
5.4.3.2. Scrolling
5.4.3.3. The mini-map
5.4.3.4. The map marker
5.5. Adding objects to scrolling environments
5.5.1. Using two-dimensional arrays
5.5.2. Creating and adding the objects
5.5.3. Scrolling the objects
5.6. Building a rotating gun turret
5.6.1. Drawing and rotating the cannon
5.6.2. Firing bullets
5.6.3. Moving and removing bullets
5.7. Destroying things!
5.7.1. Bitmap collision using points
5.7.2. Erasing the bitmap
5.7.3. Jagged rocks
5.8. Summary
6. Explosions, Blitting, and Optimization
6.1. A simple particle explosion
6.1.1. Using timer events for animation
6.1.2. Creating the Explosion class
6.1.2.1. Dynamic properties
6.1.2.2. Adding and removing explosions
6.2. A more realistic explosion
6.2.1. Taking a snapshot
6.2.2. Slicing and dicing
6.2.2.1. Tiles, tile sheets, and grids
6.2.2.2. Making the bitmap explosion
6.3. Starburst explosions
6.4. Fast particle explosions
6.4.1. Introducing bit-block transfer
6.4.2. Basic blitting
6.4.3. How fast is fast?
6.4.3.1. Calculating the frame rate and memory usage
6.4.3.2. MovieClip vs. copyPixels
6.4.4. To blit or not to blit?
6.4.5. Blit explosions
6.5. Lookup tables
6.6. An Explosion Controller
6.7. Smoke trails
6.7.1. The Perlin noise effect
6.7.2. Smoke trail optimization
6.8. Summary
7. Make It Fun! Sound, Music, and AI
7.1. Put fun first
7.2. Sound effects and music
7.2.1. Adding sound effects
7.2.2. Playing music
7.2.2.1. Playing and pausing
7.2.2.2. Restarting music
7.2.2.3. Fast-forwarding and rewinding
7.2.2.4. Changing the volume and speaker panning
7.2.2.5. Looping music
7.2.3. Using sound and music in a game
7.2.4. Finding sound effects and music
7.3. Buttons
7.3.1. Creating simple buttons
7.3.2. Making custom buttons
7.4. Enemy AI: Line of sight
7.4.1. Chasing the player
7.5. Case study: Escape!
7.5.1. Structure: your best friend and worst enemy
7.5.1.1. Creating a simple helper class
7.5.1.2. Structuring Escape!
7.5.2. Managing game screens
7.5.2.1. Delaying the game-over screen
7.5.3. Multiple views of the game data
7.5.4. New enemy AI techniques
7.5.4.1. Lying in wait
7.5.4.2. Traveling along a fixed path
7.5.5. Managing game states
7.5.6. Now make your own game!
7.6. Summary
8. Tile-Based Game Design
8.1. Tile-based game advantages
8.2. Building the game world
8.2.1. Making tiles
8.2.1.1. The tile sheet
8.2.1.2. Tile sheet coordinates
8.2.2. Making a map
8.2.3. Describing the map with a two-dimensional array
8.2.4. Creating the tile model
8.2.5. Putting the map in the game
8.2.6. Blitting tiles
8.2.7. Reviewing the Map application class
8.3. Adding a game character
8.3.1. Layering maps
8.3.2. Making the game character move
8.3.2.1. Jumping
8.3.2.2. Moving with the mouse
8.3.3. Blitting a moving character in a tile-based world
8.4. Platform collision
8.4.1. Understanding spatial grid collision
8.4.2. Finding the corners
8.4.3. Applying a spatial grid to platform collision
8.4.4. Working with round tiles
8.5. Adding more interaction
8.5.1. Adding soft platforms
8.5.2. Adding elevators
8.5.3. Collecting objects
8.5.4. Wind them up and let them loose!
8.5.5. Squashing enemies
8.5.6. Blit animations
8.5.6.1. Longer blit animations
8.5.6.2. Movie clips vs. blitting for animation
8.5.7. Switching levels
8.6. Blit scrolling
8.6.1. Adding a camera
8.6.2. Establishing game world coordinates
8.7. Using sprites in a tile-based world
8.7.1. Blitting the tile into a sprite
8.7.2. Creating the car's control system
8.7.3. Stuck in the grass
8.8. Storing extra game data in arrays
8.8.1. Creating the AI car
8.8.2. Controlling the AI car
8.9. Collision maps
8.9.1. Understanding dynamic spatial grids
8.9.2. Updating a dynamic grid
8.9.3. Creating a collision map
8.10. Other broad-phase collision strategies
8.11. Summary
9. Pathfinding
9.1. Moving through a maze
9.1.1. Centering game objects
9.1.2. Moving and changing direction
9.1.2.1. margin-left:0in
9.1.2.2. Changing direction
9.1.3. Random movement in a maze
9.1.3.1. Finding an intersection
9.1.3.2. Changing direction
9.1.4. Chasing
9.1.5. Tile-based line of sight
9.2. Finding the shortest path
9.2.1. Understanding A*
9.2.1.1. Calculating costs
9.2.1.2. Finding the second step
9.2.1.3. Linking the nodes through their parents
9.2.2. A* in code
9.2.2.1. margin-left:0in
9.2.2.2. The complete AStar class
9.2.3. Using the AStar class
9.2.4. Understanding heuristics
9.2.5. Rounding corners
9.2.6. Walking the path
9.2.7. Extending and customizing A*
9.2.7.1. Variable terrain
9.2.7.2. Influence map
9.2.7.3. Dijkstra's algorithm
9.3. Summary
10. XML and External Data
10.1. Local shared objects
10.1.1. Creating and loading shared objects
10.1.2. Using shared objects
10.1.3. Limitations of local shared objects
10.1.4. Loading and saving files to a specific location
10.1.4.1. Loading the file
10.1.4.2. Saving the file
10.2. Understanding XML
10.2.1. The building blocks of XML
10.2.2. XML hierarchy
10.2.3. XML and ActionScript
10.3. Creating XML objects
10.3.1. Reading elements, text nodes, and attributes
10.3.1.1. Reading attributes
10.3.1.2. Looping through elements and attributes
10.3.1.3. Finding all the child elements
10.3.1.4. A better way to find what you're looking for
10.4. Changing XML data
10.4.1. Adding new elements and attributes
10.4.2. Building XML documents from existing variables
10.4.3. Removing nodes from XML documents
10.5. Loading game levels from XML data
10.5.1. Creating a game level map
10.5.2. Loading and interpreting the XML map data
10.5.3. Creating multiple game levels with XML
10.6. Loading XML files at runtime
10.6.1. Using URLLoader to load files
10.6.2. Runtime loading security issues
10.6.2.1. Problems loading files locally
10.6.2.2. Problems loading files remotely
10.7. Are we there yet?
10.7.1. 3D games
10.7.2. 2D physics
10.7.3. Online multiplayer games
10.7.4. Further reading
10.7.5. Where to next?
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
About the Author
Next
Next Chapter
About the Cover Image Designer
About the Technical Reviewer
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset