The Essential Guide to Flash Games: Building Interactive Entertainment with ActionScript, is a unique book for Flash Game Developers. Rather than focusing on a bunch of low-level how-to material, this book dives straight in to building games. The book is divided into specific game-genre projects c
The Essential Guide to Flash Games: Building Interactive Entertainment with ActionScript
β Scribed by Jeff Fulton, Steve Fulton
- Publisher
- Apress
- Year
- 2010
- Tongue
- English
- Leaves
- 655
- Category
- Library
No coin nor oath required. For personal study only.
β¦ Synopsis
The Essential Guide to Flash Games is a unique tool for Flash game developers. Rather than focusing on a bunch of low-level how-to material, this book dives straight into building games. The book is divided into specific game genre projects, covering everything from old classics such as a Missile Command-style game, to hot new genres such as retro evolved. The chapters build in complexity through the book, and new tools are introduced along the way that can be reused for other games.
- The game projects covered start simple and increase in complexity as more and more tools are added to your tool chest.
- Ten full game projects are discussed in detail. Each solves a very different game development problem and builds on the knowledge gained from the previous project.
- Many advanced game development techniques are covered, including particle systems, advanced controls, artificial intelligence, blitting, scrolling, and more.
β¦ Table of Contents
Title Page
Copyright Page
Contents at a Glance
Table of Contents
About the Authors
About the Technical Reviewer
Acknowledgments
Preface
Layout Conventions
Part 1 The Basic Game Framework
Chapter 1 The Second Game Theory
Making games is an iterative process
Understanding why you want to make games
Who this book is for
So weβre not starting at the beginning?
Comparing AS3 and AS2
You canβt stick with AS2 because itβs dead
What you need to use this book
The craft of making games in the AS3 game framework
Object-oriented methodology
Encapsulation
Inheritance
Using object-oriented design to make games
Creating the basic game framework
State loop
Game timer
Event model
Testing the game
Your Second Game: Balloon Saw
Assets for this game
Graphics
Sounds
Settings
The Code
Balloon Saw gameplay
Breaking down the Balloon Saw code
Imports
Variables
Game constructor
Initializing the game loop
The playGame() function
Making the Balloons
Moving balloons
Testing collisions between the saw and balloons
Ending the game
Creating your third game: Pixel Shooter
Pixel Shooter game design
Pixel Shooter graphics
Pixel Shooter sounds
Pixel Shooter code
Pixel Shooter code highlights
New variables
Starting and restarting the player
Tracking multiple objects
Firing missiles
Detecting collisions on multiple types of objects
Creating explosions
Summary
Chapter 2 Creating an AS3 Game Framework
Exploring the Framework
The GameFrameWork.as class
The FrameWorkStates.as class
The BasicScreen class and SimpleBlitButton helper class
The ScoreBoard class and SideBySideScoreElement helper class
The Game class
The Custom event classes
The CustomEventButtonId.as class
The CustomEventLevelScreenUpdate.as class
The CustomEventScoreBoardUpdate.as class
The framework package structure
The source folder
The classes package
The projects package
The Flash IDE package structure
The Flex SDK package structure
The Main.as and StubGame.as files
Starting a project using the framework packages
Creating the stub game project in the Flash IDE
Creating the stub game project in Flash Develop
Creating game timers
Defining βframe timer tickβ
State Machines
The FrameWorkStates.as class file
The state variables
The GameFrameWork.as class file
The class imports
The variable definitions
The state control variables
The background fill variables
The timer variables
The screen definition variables
The ScoreBoard variables
The Game object variable
The wait variables
The constructor function definition
The init function definition
The setApplicationBackGround function definition
The startTimer function definition
The runGame function definition
The switchSystemState function definition
The systemTitle function definition
The systemWaitForClose function definition
The okButtonClickListener function definition
The systemInstructions function definition
The systemGameOver function definition
The systemNewGame function definition
The systemNewLevel function definition
The systemLevelIn function definition
The systemWait function definition
The waitCompleteListener function definition
The systemGameplay() function definition
The custom event listener functions
The scoreBoardUpdateListener function definition for Main.as
The levelScreenUpdateListener function definition for Main.as
The gameOverListener function definition for Main.as
The newLevelListener function definition for Main.as
Framework classes beyond Main
The BasicScreen class
Class import and variable definition section for BasicScreen
Class constructor function definition
The createDisplayText function definition
The createOkButton function definition
The button listener function definitions
The SimpleBlitButton class
The class import and variable definition for the SimpleBlitButton class
The constructor definition for the SimpleBlitButton class
The changeBackGroundColor function definition
The CustomEventButtonId class
Class import and variable definition for the CustomEventButtonId class
The constructor definition for the CustomEventButtonId class
The clone function definition for the CustomEventButtonId class
The CustomLevelScreenUpdate class
The CustomEventScoreBoardUpdate class
The ScoreBoard class
Class import and variable definition for the ScoreBoard class
The createTextElement function definition
The update function definition
The SideBySideScoreElement class
The constructor definition
The setLabelText and setContentText definition functions
The Game class
A stub game class
Game objective
Game state screen flow
Creating the Main.as class
Class import and variable definitions for the Main class
Applying the constructor and init function definitions
Creating our game instance
Setting the application back ground
Creating the score board
Creating the title screen
Creating the instructions screen
Creating the game over screen
Creating the level in screen
Setting the initial state machineβs state
Starting the game timer
The stub Game.as class
What we are doing in this class
Test it!
Summary
Chapter 3 Creating Super Click
Creating a Super Click game design specification
Defining the game basics
Calculating level progression
Defining the basic screens needed
Defining the game play variables
Defining the custom ScoreBoard elements
Describing the game play and flow
Evaluating the end of a level
Evaluating the end of a game
Defining the necessary events
Defining the game-specific custom classes
Creating Super Click
Starting the project
Creating the Super Click game project in the Flash IDE
Creating the Super Click game project in the Flash Develop
The Class file list
Creating the Main.as class
Importing classes and defining variables for Main.as
Creating our game instance
Setting the application background
Creating the Scoreboard
Creating the title screen
Creating the instructions screen
Creating the game over screen
Creating the Level In screen
Setting up the initial state machine
Starting the game timer
Creating the Game class for Super Click
Importing the classes and defining the variables for SuperClick.as
Defining the constructor and init function for SuperClick.as
Defining the newLevel function
Calling the runGame function definition
Defining the update function
Adding circles to the screen
Updating the on-screen circles
Updating the ScoreTextField instances
Optimizing the loops
Defining the removeCircle function
Defining the removeScoreText function
Defining the checkCollisions function
Fading out the circle
Defining the addToScore function
Defining the render function
Defining the checkForEndOfGame function
Defining the checkforEndLevel function
Defining the cleanUp function
The Circle Class
Defining the Circle class
Creating the Circle class in the package structure
Importing the classes and declaring variables for Circle.as
Defining the constructor and init function for Circle.as
Defining the update function for Circle.as
Defining the dispose function for Circle.as
Updating the clickedListener function definition for Circle.as
The ScoreTextField class
Defining the ScoreTextField class
Creating the ScoreTextField class in the package structure
Defining the update function for ScoreTextField
Defining the dispose function for ScoreTextField
Test it!
Summary
Part 2 Building Games
Chapter 4 Laying The Groundwork for Flak Cannon
A short history of Missile Command
Designing the game
Game development concepts in this chapter
Adding game assets to the library
Creating graphics using Spritelib GPL
Creating sounds using SFXR
Library differences in Flash and Flash Develop/Flex
Using graphic assets
Using sound
Creating a sound manager
Creating difficulty with settings
Difficulty settings
Creating sprites that move on a vector
Defining a sprite that moves between two points
Shot
BonusPlane
Ship
Creating objects that move on a continuous vector: Enemy
Creating animated sprites
Flak
Explosion
Summary
Chapter 5 Building the Flak Cannon Game Loop
Understanding the Flak Cannon game flow
Updating GameFramework.as
Defining Main.as
FlakCannon.as
Importing classes
Setting the FlakCannon.as properties and constructor
Starting a new game
Starting a new level
Handling mouse events and starting the crosshairs
Placing the ships
Handling newLevel events
Testing out the game
Creating the game loop
Checking for enemies
Checking for a bonus plane
Updating objects
Removing objects
Detecting basic bitmap collisions
Rendering objects
Ending a level
Ending the game
Playing the game!
Summary
Chapter 6 Laying the Groundwork for No Tanks!
The No Tanks! game design
Game development concepts in Chapters 6 and 7
Adding game assets to the library
Using Spritelib GPL
Using a tile sheet
Organizing game levels into tiles
Creating a level
Creating a level with Mappy
Sprites vs. tiles vs. background
Creating the tile sheet
Creating a game level with Mappy
Creating a two-layer map
Creating the background layer
Creating the sprite layer
Saving the level .FMP file
Exporting the level from Mappy
Exporting the background layer
Exporting the sprite layer
Setting up our project
Creating the No Tanks! game project in the Flash IDE
Creating the No Tanks! game project in Flash Develop
Describing our tile sheet in XML
Creating the TilesheetDataXML.as class
Tile attributes
How this code works
Using the tile sheet data in code
Create the GameDemo.as class
Reading the tile sheet data
The constants
The initTileSheetData function
Testing it out
Displaying the level data on the screen
Organizing your code
Adding the Library.as class for Flex projects only
Adding the library assets for the Flash IDE only
Using the library assets in Flex and the Flash IDE
Tile sheet blitting and sprites
Defining βblittingβ
Defining βspriteβ further
Understanding the differences between sprites and blitting
Bringing Flash into the mix
Understanding the difference between tile and sprite sheets
A full screen blit
Individual object blits
Combining types of blits
Testing blitting render speed
Testing the timeline-based method
Testing individual object blits
Testing the sprite full-screen blit
Making sense of these results
The TileSheet class
Understanding the attributes of a TileSheet
Reading the level data
The Level class
Creating the Level1 class
Updating the New GameDemo.as file
The class imports
The variable definitions
The constructor
The readBackGroundData function
The readSpriteData function
The drawLevelBackGround function
Organizing our game rendering
Summary
Chapter 7 Creating the Full No Tanks! Game
Tile-based movement theory
Tile jumping
Smooth tile-to-tile movement
The BlitSprite Class
Animating with the BlitSprite class
The TileByTileBlitSprite class
Moving the player character through the maze
The center tile trick
Adding the player (iteration 1)
Changing the class name for iteration 1
Adding the new framework classes to the import section
Defining the iteration 1 variables
The init function for iteration 1
The iteration 1 restartPlayer function
The readSpriteData function
Testing iteration 1
Moving the player using key logic (iteration 2)
Changing the class name for iteration 2
Adding a simple placeholder game timer
Switching player move state with the arrow keys
Adding the keypress logic
Testing iteration 2
Updating the move states for player movement (iteration 3)
Changing the class name for iteration 3
Adding the move state constants
Changing the runGame function for iteration 3
Updating the checkInput function
Adding the checkTile function
Adding the checkCenterTile function
Adding the switchMovement function
Testing iteration 3
Updating and rendering player movement (iteration 4)
Changing the class name for iteration 4
Updating the variable definitions for iteration 4
Updating the runGame function for iteration 4
Adding the update function
Adding the render function
Testing iteration 4
Adding and moving enemy tanks (iteration 5)
Changing the class name for iteration 5
Updating the variable definitions for iteration 5
Updating the init, newGame, and newLevel functions
Adding the setRegions function
Changing the readSpriteData function
Testing iteration 5
Allowing enemy tank movement with the AI (iteration 6)
Changing the class name for iteration 6
Making additions to the restartPlayer function
Modifying the update and render functions for enemy tanks
Adding new functions for enemy tank AI
Chasing the player
The chaseObject function
The checkLineOfSight function
The fireMissileAtPlayer stub function
Testing iteration 6
Integrating into the framework
Integrating onto the Main.as framework class
The application background and game Sprite location
The ScoreBoard
The Screens
The Sounds
The New Function Overrides for the Sounds
Finishing up the Library class
Finalizing the Level.as and Level1.as file
Finishing up the NoTanks.as file
Changing the class name for NoTanks.as
Adding to the class import section for NoTanks.as
Adding the new NoTanks.as variables
Adding the new NoTanks.as init function
Creating the newGame function
Creating the newLevel function
Creating the restartPlayer function
Overwriting the runGame function
Adding the CheckInput function
Improving the update function
Adding the checkHitWall function
The checkCollisions function
Updating the render function for NoTanks.as
Checking for the end of a level or game
Creating functions to fire missiles
Changing the readBackGroundData function
Changing the readSpriteData function
Changing the checkLineOfSight function
Adding the createExplode function
Coding the object cleanup functions
Testing the final game
Extending the game
On to Color Drop
Chapter 8 Creating the Color Drop Casual Puzzle Game
Understanding the Evolution of Casual Games
Designing the game
Game development concepts in this chapter
Adding this gameβs assets to the library
Adding sounds
Adding graphics
Defining the classes for Color Drop
Updating the Main class for Color Drop
Creating the Block class
Creating the CustomEventClickBlock class
Controlling difficulty with a level class
Creating the GameStates class
Implementing the basic game structure
Initializing the game
Adding the ColorDrop state machine
Adding blocks to the screen
Expanding update and render for ColorDrop
Waiting for user input
Using a nonrecursive function to test blocks
Removing blocks
Ending a level or the game
Test it!
Summary
Chapter 9 Creating the Dice Battle Puzzle Game
Getting started with intellectual property law
Considering copyright
Considering trademarks
Adding patents to the mix
Following the Golden Rule
Designing the Dice Battle game
Game development concepts in this chapter
Adding game assets to the library
Adding Graphics for Dice Battle
Adding sound for Dice Battle
Playing Soundtracks in Main.as
Revamping ScoreBoard
Playing SoundTracks
Updating the Main.as class
Creating AI difficulty with a class
Creating the Die class
Creating the CustomEventClickDie class
Creating the Character class
Adding the GameStates class
Setting up the game in Game.as
Creating a computer player
Taking turns using new game states
Capturing and scoring a player move
Creating the computerβs minimax-style AI
Analyzing the Dice Battle AI
Discussing the Dice Battle AI
Ending the level or game
Viewing the rest of the code for Dice Battle
Test it!
Summary
Chapter 10 Blit Scrolling in a Tile-Based World
Designing and getting started with Drive She Said
Game development concepts in this chapter
Defining new classes
Integrating with the game framework
Modifying the Library class
Adding the custom LevelInScreen Class
Transitioning between levels
Understanding free-form tile-based movement
Defining how free-form tile-based movement works
Using art-based MoveClip stage scrolling
GAS (GotoAndStop) tiles
Using tile-based blit scrolling
The World
The Camera
The Buffer
The Output Canvas
Creating the game world
Creating the Tile Sheet
Detecting collisions on the WALL tiles
Defining the game levels
Obtaining the level data
Applying basic car physics to our game
Moving forward and backward
Moving in a direction
Preparing to create our Drive She Said game
Creating the game project in the Flash IDE
Creating the game project in the Flash Develop
Updating the Main.as class for Drive She Said
Adding ScoreBoard elements
Modifying the screens
Modifying the sounds
Transitioning to the LevelInScreen
Updating the LevelInScreen text
Increasing the game Frame Rate
Creating the CustomEventHeartsNeeded.as class
Creating the Library.as class
Creating the new framework classes
Creating the BasicFrameTimer class
Creating the LookAheadPoint class
Creating the CarBlitSprite class
Creating the Camera2D class
Double (and triple) buffering
Creating the classes specific to Drive She Said
The TileSheeDataXML class
The Level.as class
The Level1.as Class
Iterating the Game class
Creating the Game class shell, variables, and constructor (iteration 1)
Keypress constants
The internal state machine
The tiles, display, and world
The camera
Car sounds
Creating a working class (hero?) in iteration 2
Setting up the game (iteration 3)
The init function
The newGame function
The initTileSheetData function
The newLevel function
The setUpWorld function
The restartPlayer function
Moving the car and game world together
The systemGamePlay function
Testing game iteration 3
Adding player input and the update / render loop (iteration 4)
The update function
The checkInput function
The render functions
The drawCamera function
The drawPlayer function
Testing iteration 4
Detecting collisions and the end of a level or the game (iteration 5)
The checkCollisions function
The rest of the game functions
Testing the final game
Extending the game
Summary
Chapter 11 Creating an Optimized Post-Retro Game
Understanding post-retro games
Defining post-retro
Exploring the features of post-retro games
Emerging post-retro game features
Tracing the history of post-retro games
What the post-retro genre means to developers
Designing Blaster Mines
Game development concepts in this chapter
Modifying the game framework
Checking stage access
Creating the New addedToStage function
Adding pause and mute functionality to the framework
Adding the time-based step timer
Adding the runEnterFrame function
Optimizing using render profiling
Designing the FrameRateProfiler technical design
Monitoring frame rate and memory usage
Changing the game class
Getting Started with the Blaster Mines Project
Creating the Blaster Mines game project in the Flash IDE
Creating the Blaster Mines game project in Flash Develop
Creating the Main.as class for Blaster Mines
Implementing the pause and mute functionality
Adding the new constructor function
Adding the addedToStage function
Implementing the time-based step timer for Blaster Mines
Customizing FrameRateProfiler for Blaster Mines
Creating the frameRateProfileComplete function
Creating the Library.as class
Modifying the SoundManager class
Optimizing with object pooling
Conserving processor execution time
Conserving memory
Implementing object pooling in our game
Creating the technical specifications for object pooling in Blaster Mines
Adding the private variables
Instantiating a particle in the pool
Making a particle active
Making a particle inactive
Optimizing with single-unit processing and memory conservation
Reusing global event objects
Optimizing with look-up tables
Creating the movement vector look-up table
Accessing the vectorRotationList look-up table
Optimizing screen-based blit scrolling with ScrollRect
Optimizing BitmapData reuse for the radar screen
Creating the new game classes
Designing the BlitArrayAsset class
Designing the BasicBlitArrayObject class
Designing the BasicBlitArrayParticle class
Designing the BasicBlitArrayProjectile class
Designing the BlitArrayPlayerFollowMouse class
Designing the MineManager class
Designing the ParticleManager class
Designing the ProjectileManager class
Designing the Mine class
Building the Blaster Mines class
Creating the Blaster Mines class shell
Adding the Blaster Mines game init functions
Adding the newGame and newLevel functions
Updating the game loop and internal state machine
Adding the update, autoShoot, render, and collision functions
Adding auxiliary functions
The full GameFrameWork class
Test it!
Summary
Chapter 12 Creating a Viral Game: Tunnel Panic
Defining viral web games
Distributing a viral web game
Using your own web site
Using social news sites
Twitter
Facebook
Uploading to portals
Social gaming sites
Selective portals
Making money from your viral game
Using in-page ads
Entering contests
Inserting in-game ads with Mochi Media
Obtaining licenses and sponsorships
Exclusive Licenses
Sponsorships
Nonexclusive licenses
API licenses
Getting a game sponsored
Using FlashGameLicense.com
Using FlashGameDistribution and GamerSafe
Working with Adobe Flash Platform Services
Securing your viral games
Using site locking
Encrypting your game
Marketing viral Flash games
Some Other Great Web Resources
Preparing to create our Tunnel Panic game
Creating the game project in the Flash IDE
Creating the game project in the Flash Develop
Preloading in the Flex SDK
Adding the compiler directive
Adding the Preloader class code
Preloading in the Flash IDE
Adding files to the library
Creating the timeline
Creating an asset holder MovieClip
Linking the assets
Putting the assets into the asset holder
Placing the asset holder on the main time line
Framework Changes for Flash IDE preloading
Adding in the new Flash IDE preloader state to the framework
Adding new variables for the preloader state
Defining the preloadScreen instance
Setting the preloader to be the first state in Main
Adding to the switchSystemState function
Adding the new systemPreload and addSounds functions
Adding Mochi preloader ads and leader boards
Importing the Mochi package
Changing the Main.as object type
Adding Mochi-related variables to the framework
Changing switchSystemState
Making Mochi ad-specific changes
Making the leader-boardβspecific changes
Creating our own viral game
Designing the Tunnel Panic game
Creating the PlayerSprite object
Creating the play field
Adding the obstacles
Animating the player shipβs exhaust
Using dirty rect erase
Increasing the game difficulty
Ending the game
Creating the Main.as for Tunnel Panic
Changing Game.as for Tunnel Panic
Changing Main.as for Tunnel Panic
Creating the Library.as class for Flex SDK only
Adding to the Flash IDE Library
Coding the TunnelPanic.as class
Test it!
Summary
Index
π SIMILAR VOLUMES
The Essential Guide to Flash Games: Building Interactive Entertainment with ActionScript, is a unique book for Flash Game Developers. Rather than focusing on a bunch of low-level how-to material, this book dives straight in to building games. The book is divided into specific game-genre projects c
<p><p>For any professional designer or developer working in the world of web technologies or multimedia, Flash is the must-have application, and knowing how to use it effectively is vital. Add in ActionScript 3.0, and Flash becomes an even more powerful tool for the development of high-performance w
<p><p>For any professional designer or developer working in the world of web technologies or multimedia, Flash is the must-have application, and knowing how to use it effectively is vital. Add in ActionScript 3.0, and Flash becomes an even more powerful tool for the development of high-performance w