DOC PREVIEW
U-M CIS 487 - Game Design I

This preview shows page 1-2-3-24-25-26 out of 26 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 26 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 26 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 26 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 26 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 26 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 26 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 26 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CIS 487 - Game Design I Chapter 4 and 5Ch 4 – Flak Cannon DesignWhat’s New?Game Basics – Flak CannonSound and Graphics AssetsSFXRUsing SoundSoundManager.asSlide 9Important Items for SoundManagerSettingsVector MovementShot.asVector ImplementationSprite AnimationCh 5 – Flak Cannon ImplementationIncorporating SoundManagerSoundsImplementing Flak CannonSlide 20newGame()Slide 22newLevel()Difficulty CalculationAdditional ItemsrunGame()CIS 487 - Game Design IChapter 4 and 5Blake Farrugia10/24/2011Ch 4 – Flak Cannon Design•Flak Cannon is a Missile Command type game where ships must be defended from incoming kamikaze fighters.•Chapter 4 deals much with the concept, design, and planning of Flak Cannon.–Always a good thing to do before coding.•Chapter 5 deals with implementation.What’s New?•Sound Management–Adding and triggering sounds•More Sprite Sheet Animation–Another way of accomplishing it•Settings Implementation•Vector-based Sprite Movement–Important and awesome!Game Basics – Flak Cannon•Defense shooter–Limited ammo; get more from destroying bonus planes. Extra live when 10,000 points are met.–Shells explode where clicked; area of effect•Levels have a set number of planes as waves•Difficulty is raised each level with speed, appearance rate, and number of planes increasing.Sound and Graphics Assets•You will not need to create assets for Flak Cannon; the author already has.•For future reference, if you are not able to make graphics, look online for free sound or graphics libraries. http://www.villagegeek.com/HTML/wavfiles1.htm•These can be used for commercial and personal projects alike.–Make sure you read their licenses!!SFXR•There is an open source sound editor available http://www.drpetter.se/project_sfxr.htmlUsing Sound//custom sounds declared in Main.aspublic static const SOUND_EXPLODE_FLAK:String = "sound explode flak";[Embed(source = 'assets/flakassets.swf', symbol = "SoundExplodeFlak")] private var SoundExplodeFlak:Class;SoundManager.as•New Support class to the Game Framework•Supports multiple channels and as many sounds as needed•Sounds are called via the CustomEventSound event sent back to Main.as•Sounds tracks and regular sounds are treated differently for looping purposesSoundManager.aspublic class SoundManager {private var sounds:Array;private var soundTrackChannel:SoundChannel=new SoundChannel();private var soundChannels:Array = []; private var soundMute:Boolean = false; private var tempSoundTransform:SoundTransform = new SoundTransform(); private var muteSoundTransform:SoundTransform = new SoundTransform(); private var tempSound:Sound; public function SoundManager() {sounds = new Array();}}Important Items for SoundManager•SoundTransform – modifies certain sound’s volume or offset•SoundChannel – actually plays a sound.–soundChannels:Array – holds individual sound items–soundTrackChannel:SoundChannel – single sound track channel; only one channel for soundtracksSettings•Different variables which control certain aspects of the game•These settings shift difficulty and control balance within the game–The trick is to balance how many settings you implement with code complexity/bugs•The player cannot change settings, they are controlled by simple if:else clauses•numEnemies = (numEnemies > 100) ? 100 : level * 10 + (level * 5);Vector Movement•Given a sprite, move via a vector from point A to point B. This is accomplished with vectors.•Shot’s fire from bottom center of the screen to the center of the crosshairs.•Using these two points, we can draw a line. We apply direction and speed and we can create movement along it.Shot.as//**Flex Framework Only[Embed(source = "assets/flakassets.swf", symbol="ShotGif")]private var ShotGif:Class;public function Shot (startX:Number, startY:Number, endX:Number, endY:Number) {startLocation = new Point(startX,startY);endLocation = new Point(endX,endY);nextLocation = new Point(0,0);init();}Vector Implementation•Within the Shot.as class, speed, start and end points, and image data are stored.•Find the distance between the two points.•moves – frames the animation takes (Euclidean distance function is used)–moves = distance/speed;•Finally, get units to move on x and y axis for each frame:–xUnits = (endLocation.x – startLocation.x)/moves;Sprite Animation•This method assumes each sprite of a given animation has been embedded within the object which will play it.•As we saw in the previous sprite sheet animation lecture these sprite images are then assigned to an array.•A new sprite from the array is displayed for each new animation after so much time passes (in milliseconds)•This heavily relies on MovieClips and allows Flash to redraw regions as it needsCh 5 – Flak Cannon Implementation•The implementation of Flak Cannon adds all the assets that were created in Chapter 4.•Along with new classes, Chapter 5 tells key variables to work with certain functions and includes changes to existing framework classes.Incorporating SoundManager•A reference must be added in GameFramework’s properties section•A CustomSoundEvent must be added to event functions in GameManager.as•The sound event will use the new function soundEventListener() to manage sound files and play what is needed through the use of static sound variable strings in Main.asSounds•New sounds are added via SoundManager.addSound()•The first parameter is the string value that ties to the second value, which is the sound class.Implementing Flak Cannon•FlakCannon.as holds update loop code, settings, and tracking of each game object•FlakCannon.as follows the standard implementation as the last few games, but the complexity has grown with new collision detection and vector-based movementSettings•Just a few new difficulty settings•Level updatecode modifiesmost of thesesettings.newGame()•One of the places that the Flakcannon class interfaces with the Main calls•This allows Main to be in control and still allows Flakcannon to take care of game logic•Similar to SuperClick but the Scoreboard class is sent information about the number of ships the player has left in the fleet using the event CustomEventScoreBoardnewGame()override public function newGame():void {level = 0 ;score = 0;ships = 3;shots = 0;extraShipCount=0;isGameOver = false;dispatchEvent(new


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?