Game Development Reference
In-Depth Information
public function runGameTimeBased(paused:Boolean=false,timeDifference:Number=1):void {}
}
}
We added these two public variables:
public var timeBasedUpdateModifier:Number = 40;
public var frameRateMultiplier:Number = 1;
The timeBasedUpdateModifier was discussed in the section called “Adding the time-based step
timer.” It is the number of timer ticks we want the game to run at per second. It is the desired
frame rate of the game, but we don't call it frame rate, so it will not be confused with the actual
frame rate from the FrameCounter class.
The frameRateMultiplier variable has been added to allow the game designer to make use of the
profiled frame rate. For example, in Blaster Mines, if the profiled frame rate is 85 percent of the
desired frame rate then this multiplier is set to 2. This doubles the particles used in explosions.
These are the new public functions:
public function setRendering(profiledRate:int, framerate:int):void {}
public function runGameTimeBased(paused:Boolean=false,timeDifference:Number=1):void {}
The setRendering function is used to set the frameRateMultiplier variable. It takes in the
profiledRate and the frameRate desired for the game. By overriding this function the developer
will use this information in a custom manner to set the game quality. Blaster Mines contains a
good example of this that we will see when we take a look at the game code in detail.
The runGameTimeBased function was discussed in the “Adding the time-based step timer” section.
It accepts in the paused value from Main along with the timeDifference from the GameFrameWork 's
runGameEnterFrame function.
Getting Started with the Blaster Mines Project
As with all of the games in this topic, Blaster Mines will use the framework package structure we
created in Chapter 2. Let's begin by creating the package necessary for our game in both the
Flash IDE and Flash Develop (for use with the Flex SDK).
Creating the Blaster Mines game project in the Flash IDE
Here are the steps needed to create the game in the Flash IDE
1.
Start up your version of Flash. We are using CS3, but this process should work exactly
the same in CS4 and CS5.
2. Create a .fla file in the /source/projects/blastermines/flashIDE/ folder called
blastermines .
3. In the /source/projects/blastermines/flashIDE/ folder, create the package structure
for your game: /com/efg/games/blastermines/ .
Search WWH ::




Custom Search