Essential Flash Games Book #2 (chapters 6 and 7)
I have just completed (finally) chapters 6 and 7 of our
upcoming Essential Flash Games Book.
These two chapters go into exhaustive detail on creating a maze-based,
over-head 2D shooter in the Armor Attack genre. The game is not one that I
would want to release to any portals yet. Compared to the even moderately
good games out there, it is lacking some polish. In any case, the point of
these two chapters was to explain how to create a tile-based environment using Mappy, XML, TileSheets, Blitting, Maze-Chase AI, and Line Of Sight firing. I looked
over a number of books in my game development library before I started these
two chapters and none give this level of detail, so I am please with how it
came out. This set of chapters
brings in the low-level set blitting classes I wrote
about very early in the year when I was discussing my Generalized Flex Game
framework. By no means are these the best, most exhaustive set of framework
classes available, but they are clean and simple, and extend the book’s
framework nicely.
The TileSheet class is the basic building block for
creating game assets. It is agnostic to implementation, so a TileSheet instance could simply be a single imported
png graphic that is static and placed in a Sprite (in
a Bitmap instance). Or, it can represent a sheet of any sized tiles that can be
used for blitting operations.
The BlitSprite
class is an extension of the Sprite class that includes properties and
functions for using a TileSheet instance for bitting to its own internal canvas (A Bitmap Object) for
animation. The canvas is located at -.5*x, -.5*y to allow the Bitmap to be
rotated and resized and around the center of the Sprite. It is still a Sprite though. The BlitObject class will be introduced in chapter 10. This
will eliminate the use of the built-in Sprite class for those who want to go to
a full screen blit.
The TileByTileBlitSprite
class is an extension of the BlitSprite class with
properties specific to an object moving about a maze (using the center of each
tile).These two chapters also include topics covering
everything from pixel perfect collision detection to creating dynamic warp
tunnels and navigating a tile-maze with ’tile center’ logic. It took 104 Word
2008 pages to get it all it though all.
Having finished up this section, I am pleased with my
accomplishment (especially given the 14 hour day-job work days I have been
putting in lately), but I am still skeptical of its quality. Nothing good comes from rushing to the
finish line, so even though it was due last Monday, I am turning it in this
Monday. I hope to catch up (time-wise) in my next set of chapters (10 and 11)
that will deal with creating a scrolling space shooter using larger tiles for ‘full
screen blit scrolling’.
Here is a sample picture of the game for chapters 6 and 7.
It uses SpriteLib (Ari Fledman’s
Sprite Library):
It doesn’t look like much yet (although Ari’s sprites are sweet), but the reader is given
enough information to turn this little engine into any game they desire. I will
be adding a lot of zarjaz to my version and shoving
it out on our site (and possibly Mochi) when I find time to catch a breather’