Game Development Reference
In-Depth Information
Chapter 7
Creating the Full No Tanks! Game
In the previous chapter, we covered a lot of ground in our No Tanks! game. We explored tile
sheets, levels, XML, and blitting to a BitmapData canvas. In this chapter, we will finish up the
game and cover some more advanced topics such as smooth tile-base grid movement and a
“good enough” enemy chase AI. We are going to plow through a lot of code very quickly, and
we'll need to be pretty efficient to fit all of the game logic and changes to the framework into the
allotted space. So, hold on, read everything very carefully, and please check out the AS3
documentation provided by Adobe if you are stuck on any language concepts we skip over or
only cover briefly.
We will have to cover a lot of ground fast to complete this game in the space allotted. To do so,
we will cover some topics in detail, and only present the code and a brief description for others.
Creating a BlitSprite class for game objects
Extending the BlitSprite class for tile maze-based game logic
Animating a Sprite with bitmap tiles
Moving a the player and enemy around a user designed tile game level
Creating basic chase AI using zones and logic
Using line-of-site firing against the enemy player
Using look-ahead variables for collision detection and movement
Finishing off the game with sound and screens
Modifying the framework for No Tanks!
Extending the Library class
In the previous chapter, we started to create a file called GameDemo.as . We are going to continue
modifying that file in the following sections until we have a complete game. The first thing you
should do is open the GameDemo.as file in Flex, Flash Develop, or in the Flash IDE (along with the
no_tanks.fla file for the IDE). We will eventually change the game file name from GameDemo.as to
NoTanks.as and integrate it into the framework, but for now, you can leave it as is. Now that
you've got the files open, let's get to work.
Search WWH ::




Custom Search