Basic Game Frameworks


Published on

WSU IT7220 Week 7

1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Basic Game Frameworks

  1. 1. Basic Game Frameworks IT 7220 - March 2, 2009 Monday, March 2, 2009
  2. 2. Agenda • OOP Concepts and Overview • Planning the Game - Storyboard • Rosenzweig Chap 3 - Matching Game • HOT: Video in Flash - Perkins Chap 16 • Lab and Group Work Monday, March 2, 2009
  3. 3. Some OOP Concepts • Classes • Inheritance • Encapsulation • Aggregation • Polymorphism Monday, March 2, 2009
  4. 4. OOP - Classes • Provide the foundation for OOP in Flash • Collections of related functions and variables to achieve specific goals • Examples include Document, MovieClip, flash.display.Graphics. Monday, March 2, 2009
  5. 5. Class Example ✤ All document classes are ✤ derived from either the MovieClip or Sprite class MovieClip class is a container ✤ class which includes the stage and timeline with each instance created This allows the text object to ✤ be added to the movie clip Document class must then be ✤ added to the Flash project file using the properties panel Monday, March 2, 2009
  6. 6. OOP - Inheritance • One of the most recognized benefits of OOP model • Allows you to inherit attributes from the original class, also called the parent, super, or ancestor class Monday, March 2, 2009
  7. 7. Inheritance in General Animal Toy Vehicle Dog Ball Car Beagle Beach Ball Hybrid Monday, March 2, 2009
  8. 8. OOP - Encapsulation • Allows you to hide class properties and methods from other parts of the project, but still allows you to manipulate them in a controlled fashion • Within a class encapsulation is enabled using public and private key words • In the matching game, encapsulation is used to contain all of the game elements within a movie clip Monday, March 2, 2009
  9. 9. OOP - Aggregation • Similar to the concept of Inheritance Inheritance rule of thumb: “is a”(door) • Aggregation allows you to create objects composed of other objects (classes) Aggregation rule of thumb: “has a” (house) • Aggregation makes it easier to switch out items of which a class is composed Monday, March 2, 2009
  10. 10. OOP - Polymorphism • Allows you to customize methods (functions) inherited from a superclass (or parent class), to add specialization to a subclass (child class) • This is done by redefining the method in the subclass using the override keyword Monday, March 2, 2009
  11. 11. Polymorphism Example Monday, March 2, 2009
  12. 12. Game Planning Activities Referring to Quinn (Chapter 6) • Planning begins with Analysis and is then validated during Specification Phase • This includes • Vision - how, where, when, and how will game be used? • Purpose - how will the game enable the overall learning experience? • Objective - what is the targeted performance, how will it be measured? • Description - describe the game in terms of content, engagement, and experience. • Audience - what we know about targeted learner characteristics and interests. • Initial design strategy - mini, linked, or contingent scenarios • Theme - story and creative elements to bring it all together. • Genre - matching, memory, trivia, action, shooting, puzzle, adventure,... Monday, March 2, 2009
  13. 13. Storyboard/Prototype Introduction screen to Game over and Game movie clip. A provide instructions debrief screen. In the matching game has and initiate play and case of the matching been selected based on clicking play button. game, this includes planning discussions players final score, around theme time, and button to selection. Existing play again. game may serve as template. Monday, March 2, 2009
  14. 14. Basic Rule Structure • 18 pairs of icons (36 total cards) will be randomly arranged using a 6X6 grid • Player selects first card which remains face up • Player selects a second card • If a match both cards are removed from grid • If not, cards remain face up until a new card is selected, turning previous pair of cards face down Monday, March 2, 2009
  15. 15. Interactive Elements • Add timer and scoring element; user earn 100 pts for each correct match and lose -5 pts for each incorrect match • Add sounds for first card, match, and mismatch • Animate card flips (getting really fancy) • Limit viewing time; i.e., turn cards back over after two seconds • Allow player to reset game Monday, March 2, 2009
  16. 16. Workflow 1. Create game grid with an instance of movie clip (mc contains 19 frames) in each square: MatchingGame1.fla 2. Insert constant values to control grid layout: MatchingGame2.fla 3. Shuffle and assign card faces (i.e., 1 of 18 frames from movie clip object) to grid: MatchingGame3.fla Monday, March 2, 2009
  17. 17. Workflow (cont.) 4. Add keyboard listeners to grid and test using output panel: MatchingGame4.fla 5. Add game play logic for three states of cards (no cards turned over, 1 card, 2 cards, match): MatchingGame5.fla 6. Encapsulate game to add intro and game over screens: MatchingGame7.fla Monday, March 2, 2009
  18. 18. Workflow (cont.) 7. Add scoring to game: MatchingGame8.fla 8. Add timer; add score and time to game over page: MatchingGame9.fla 9. Add flip animation, limit viewing time, and add sound effects: MatchingGame10.fla Monday, March 2, 2009
  19. 19. HOT - Video in Flash • File formats supported for import: .avi, .dv, .mov., .mpg, .mpeg, .wvm, .asf • Support for two video compression algorithms (codec): Sorenson Spark and On2 VP6 • Support for video editing within Flash • Flash Video Encoder (external app) Monday, March 2, 2009
  20. 20. Lab and Group Work Monday, March 2, 2009