Game Development Reference
In-Depth Information
}
public function endLevel():void {
cleanUpLevel();
dispatchEvent(new Event(NEW_LEVEL));
}
public function cleanUpLevel():void {
for (var r:int = 0; r < board.length; r++) {
for (var c:int = 0; c < board[r].length; c++) {
tempBlock = board[r][c];
removeBlock(tempBlock);
}
}
}
You should also finish off the class definition with the following brackets c at the end of
ColorDrop.as:
}
}
Test it!
OK, now you have all the code for a casual puzzle style game written in ActionScript 3.0 using a
reusable game framework. Once you've typed in all the code (or downloaded it), try the game.
Notice that the game starts out very easy and gets difficult very quickly. By experimenting with the
values in the DifficultyLevel classes, you can alter the game play and difficulty significantly.
Summary
In this chapter, we have built a unique game based on casual games that we discussed at the
beginning of the chapter. We have built an internal game state machine and an iterative solution
for matching like objects in a grid. And we have done this while keeping our code within the game
framework that we have already built.
Notice, that while the Color Drop game is very simple, the code and ideas behind it are not. They
lay the groundwork for nearly any game of this type that you might want to make. Sure, the
iterative and recursive functions to test the blocks after the player had made a move might be
different for another game, but the seeds are here for you to explore these types of games.
Here are some questions for you to ponder:
What could be done make this game more fun to play for a longer amount of time?
How would you make it easier to play?
How could you change the game to disallow diagonal Block matches?
What could be added to make this a truly addictive game?
We are finished with Color Drop but not with this style of game. In the next chapter, we will
explore some of these ideas further by taking this basic engine and evolving it into another game
style that has furthered the casual genre in the past couple years.
Search WWH ::




Custom Search