DOC PREVIEW
U-M CIS 487 - Game Design I

This preview shows page 1-2-20-21 out of 21 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 21 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CIS 487 - Game Design I Chapter 6 and 7Chapter 6 – No TanksSetupTile Set with ID NumbersMap SetupMap Sprites and Object SpritesUsing Tile DataSlide 8Slide 9Slide 10Slide 11Flash Region DrawingNew Level CreationChapter 7 – Game ImplementationTile MovementBlitSprite.asTileByTileBlitSprite.asGame SetupIteration TestingIterationsRegion Tracking and Chase ObjectsCIS 487 - Game Design IChapter 6 and 7Blake Farrugia10/24/2011Chapter 6 – No Tanks•The next game focuses on projectile shooting using tanks.•You play a green tank, killing blue tanks and gaining treasure to complete the level.•This game incorporates everything the book has covered so far.•New changes include tiles, sprite sheets, maze logic, moving enemy AISetup•The last chapters talked about sprite sheets in general, but they implemented the assets in a separate image manner•This chapter uses an actual sprite sheet (one full picture) to animate the player, enemies, and explosions•Sprites are all 32x32 pixels; the map is set up as a 20x15 grid of tiles created using GIMPhttp://www.gimp.orgTile Set with ID Numbers 0 1 2 3 4 5 6 7 8 16 24 25 26 27 28 29 30 31Map Setup•Each tile ID is stored a 20x15 2D array of ints•The game uses this information to set each tile as needed to be in the map•No Tanks creators used a tile map editor called Mappy to make their map setup easier http://tilemap.co.uk/index.html •Arrays for map setup are stored in the Level1 class derived from LevelMap Sprites and Object Sprites•The map itself is made of environment tiles, but object sprites are made of their own separate tiles•Some are in sets (idle sprite, animation sets)•Icons such as ammo upgrades and extra lives have their own sprites•Object sprites are stored in a 2D array within the Level1 classUsing Tile Data•Mappy exports code usable by ActionScript, but some work has to be done to make that code functioning•Mappy creates 2D arrays for Level1.as to useMap SetupbackGroundMap = [[26,24,25,0,26,26,26,26,26,0,0,26,26,26,26,26,0,24,25,26],[27,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,27],[29,0,28,0,0,0,24,25,0,24,25,0,24,25,0,0,0,27,0,29],[27,0,28,0,27,0,0,0,0,0,0,0,0,0,0,27,0,29,0,27],[29,0,0,0,29,0,0,30,0,0,0,0,31,0,0,29,0,0,0,29],[0,0,28,0,26,0,0,31,0,0,0,0,31,0,0,26,0,26,0,0],[0,0,0,0,0,0,0,31,0,0,0,0,31,0,26,0,0,0,0,0],[26,26,26,0,0,26,0,30,30,30,30,30,30,0,0,0,0,26,26,26],[0,0,0,26,0,0,0,0,0,0,0,28,0,0,0,0,26,0,0,0],[0,0,0,0,26,0,0,27,0,27,0,27,0,28,0,26,0,0,0,0],[27,0,0,0,27,0,0,29,0,29,0,29,0,28,0,27,0,0,0,27],[29,0,0,0,29,0,0,0,0,0,0,0,0,0,0,29,0,0,0,29],[27,0,0,0,0,26,0,28,0,28,0,28,28,0,26,0,0,0,0,27],[29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29],[26,24,25,0,0,26,26,26,26,0,0,26,26,26,26,0,0,24,25,26]];Map Setup spriteMap = [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,22,0,0,0,0,0,9,0,0,20,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[1,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,9,0,9,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,9,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,9,0,23,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]];Using Tile Data•TileSheetDataXML.as to store all tile data and some frame data from XMLpackage com.efg.games.notanks {public class TilesheetDataXML {public static var XMLData:XML=<tilesheet><tile id="0" name="road" type="walkable"></tile><tile id="1" name="player" type="sprite"></tile><tile id="2" name="player" type="sprite"></tile> ……<tile id="31" name="blueblock8" type="nonwalkable"></tile><smallexplode tiles="17,18,17"></smallexplode><largeexplode tiles="17,18,19,18,17"></largeexplode></tilesheet>;} // end class}// end packageUsing Tile Data•The GameDemo class parses and assigns tiles and creates all level properties•This class will be extended incrementally to build the complete game•Complete game is contained in GameDemoIteration6.asFlash Region Drawing•The sprite blitting used in No Tanks combines bitmap redrawing with Sprite class screen invalidation techniques that Flash does so well•Want to see Screen Invalidation? Right click most Flash applications and click the option “Show Redraw Region”•Individual object sprites (tanks, upgrades) will redraw themselves separately rather than drawing to background constantlyNew Level Creation•New levels are hardcoded on top of a Level class.•This is due to the fact that the author wants to keep all resources within the SWF and not have any external resources•This changes as needed, but the first (and only) level is called Level1Chapter 7 – Game Implementation•This chapter focuses on:–AI Logic•Line-Of-Sight firing•Pathfinding–Individual Sprite Blitting•Rotation•Smooth MovementTile Movement•Tile-By-Tile movement used to be the norm for tile-based games. It’s rickety and not too pleasant to view•Smooth tile movement will be used in No Tanks•Cornering will only work when sprites are in the center of a given tileBlitSprite.as•A class that extends Sprite while adding frame animation functions•A reference of TileSheet is passed to it, and the held bitmap is redrawn individually using the copyPixels method•Rotation functionality is appended into this class and will be utilized by the next class, TileByTileBlitSprite.asTileByTileBlitSprite.as•A class extending BlitSprite, so BlitSprite functionality can be used for non-tile games•Holds additional direction, movement, and destination logic•Sprites that are not environment will use this classGame Setup•The majority of the game is run through NoTanks.as•A majority of the game’s setup is run through GameDemo.as•NoTanks handles much of the event code after GameDemo’s initial setupIteration Testing•Within the project, there are several versions of the GameDemo class•Each class adds new functionality and incrementally builds the entire game•These were general tests for successful integration of all parts of this game:–Sprite Rendering/Collisions–AI Logic–Movement–SoundsIterations•Iteration 1 – adds the player avatar coide•Iteration 2 –


View Full Document

U-M CIS 487 - Game Design I

Documents in this Course
Mad Maxim

Mad Maxim

10 pages

DirectX

DirectX

10 pages

Load more
Download Game Design I
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Game Design I and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Game Design I 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?