Game Development Reference
In-Depth Information
Creating a game level in the Mappy Level Editor
Creating a library class for Flex projects
Creating a TileSheet class
Creating an Level base class
Extending the Level base a class to hold the level specific data
Blitting the game world tiles to a BitmapData output screen
Chapter 7
Creating a BlitSprite class for game objects
Extending the BlitSprite class with tile maze based game logic
Animating a Sprite with bitmap tiles
Moving a player and enemy around a user designed tile game level
Creating basic chase AI using zones and logic
Using line of site for enemy firing on the player
Using look-ahead variables for collision detection and movement
Finishing off the game with sound and screens
Modifying the framework for No Tanks!
Adding game assets to the library
In Flak Cannon, we used assets from the Spritelib GPL library. We will use some of them again,
but this time, we will place all of our assets on a sheet of 32
32 tiles rather than add them to the
game as separate graphic objects. We will also be using the SFXR to tool to create the sounds
for our game.
Using Spritelib GPL
As in the previous game, we will be using the Spritelib GPL, maintained by Ari Feldman and
located here: http://www.flyingyogi.com/fun/spritelib.html . This is a royalty-free graphics
library, which means you can use it for pretty much anything (save for distributing it as part of
another sprite library). Several of the games in this topic make use of this library.
Using a tile sheet
One of the most useful advances in ActionScript for game developers has been the use of raw
bitmap data to render on-screen images. A tile sheet is a bitmap image file (GIF, JPG, PNG,
etc.) that is organized into a series or rows and columns in a grid format. The most common tile
sheet format is a set of rows and columns of square-sized images. For example, we will be using
image tiles with a 32-pixel width and a 32-pixel height. We will call these tiles 32
32 tiles. We
will create a sheet of these tiles that is organized into rows and columns (see Figure 6-1). The
tiles will be used to create the background and sprite animations for our game.
Rather than importing each 32
32 bitmap tile into the Flash library individually we will import the
entire tile sheet into our game as a single file. We will then cut out the tiles as we need them
using code. This will be done using the BitmapData class in AS3.
Search WWH ::




Custom Search