Game Development Reference
In-Depth Information
DifficultyLevel classes are bit more interesting. Here is a sample of a DifficultyLevel we are
going to create:
difficultyLevelArray.push(new DifficultyLevel([Die.DIE_COLOR_WHITE],150,3,20,7));
Now let's review the parameters that are passed to DifficultyLevel, as we will make use of these
fairly quickly:
[Die.DIE_COLOR_WHITE] : An array of the colors of dice that will be on this level
150 : The hit points (life) for this enemy
3 : The tile from characters to display on this level for the enemy
20 : The AI bonus to append to the random value generated from 0-99 to help choose
the computer's move
7 : The lowest value this enemy will accept when making a move (if there are values
equal to or above it)
We created ten levels for this game, and all of them follow a similar pattern. To make the game
harder, we could add more dice colors to make matching harder, add enemies with more hit
points, and increase the AI bonus and the low score threshold. All of these things can (and
should) be tweaked to balance the game. Because this game involves AI, we have only really
scratched the surface of how this game could be tweaked using these values. You should
experiment to see how small changes to in this section affect the overall difficulty in the game.
public function init():void
{
//***** Flash IDE *****
tileSheet = new TileSheet(new DiceSheet(0,0), DIE_WIDTH,DIE_HEIGHT);
charSheet = new TileSheet(new Characters(0,0), CHAR_WIDTH,CHAR_HEIGHT);
//***** End Flash IDE *****
//***** Flex *****
//tileSheet = new TileSheet(new DiceSheet().bitmapData, DIE_WIDTH, DIE_HEIGHT);
//charSheet = new TileSheet(new Characters().bitmapData, CHAR_WIDTH, CHAR_HEIGHT);
//***** End Flex ***** difficultyLevelArray = new Array();
difficultyLevelArray = new Array();
difficultyLevelArray.push(new DifficultyLevel([Die.DIE_COLOR_WHITE],100,1,0,0));
difficultyLevelArray.push(new DifficultyLevel([Die.DIE_COLOR_WHITE],125,2,10,6));
difficultyLevelArray.push(new DifficultyLevel([Die.DIE_COLOR_WHITE],150,3,20,7));
difficultyLevelArray.push(new DifficultyLevel([Die.DIE_COLOR_WHITE,
Die.DIE_COLOR_BLUE],175,4,30,7));
difficultyLevelArray.push(new DifficultyLevel([Die.DIE_COLOR_WHITE,
Die.DIE_COLOR_BLUE],200,5,40,7));
difficultyLevelArray.push(new DifficultyLevel([Die.DIE_COLOR_WHITE,
Die.DIE_COLOR_BLUE],225,6,50,7));
difficultyLevelArray.push(new DifficultyLevel([Die.DIE_COLOR_WHITE,
Die.DIE_COLOR_BLUE],250,7,60,7));
difficultyLevelArray.push(new DifficultyLevel([Die.DIE_COLOR_WHITE,
Die.DIE_COLOR_BLUE,Die.DIE_COLOR_GREEN],275,8,70,7));
difficultyLevelArray.push(new DifficultyLevel([Die.DIE_COLOR_WHITE,
Die.DIE_COLOR_BLUE,Die.DIE_COLOR_GREEN],300,9,80,7));
difficultyLevelArray.push(new DifficultyLevel([Die.DIE_COLOR_WHITE,
Die.DIE_COLOR_BLUE,Die.DIE_COLOR_GREEN],325,10,90,7));
}
Search WWH ::




Custom Search