basic game frameworks

20
Basic Game Frameworks IT 7220 - March 2, 2009 Monday, March 2, 2009

Upload: indiana-state-university

Post on 10-May-2015

1.146 views

Category:

Education


0 download

DESCRIPTION

WSU IT7220 Week 7

TRANSCRIPT

Page 1: Basic Game Frameworks

Basic Game Frameworks

IT 7220 - March 2, 2009

Monday, March 2, 2009

Page 2: Basic Game Frameworks

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

Page 3: Basic Game Frameworks

Some OOP Concepts

• Classes

• Inheritance

• Encapsulation

• Aggregation

• Polymorphism

Monday, March 2, 2009

Page 4: Basic Game Frameworks

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. Flash.display.events

Monday, March 2, 2009

Page 5: Basic Game Frameworks

Class Example

✤ HelloWorld3.as✤ 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

Page 6: Basic Game Frameworks

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

Page 7: Basic Game Frameworks

Inheritance in General

Animal

Dog

Beagle

Toy

Ball

Beach Ball

Vehicle

Car

Hybrid

Monday, March 2, 2009

Page 8: Basic Game Frameworks

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

Page 9: Basic Game Frameworks

OOP - Aggregation

• Similar to the concept of InheritanceInheritance 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

Page 10: Basic Game Frameworks

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

Page 11: Basic Game Frameworks

Polymorphism Example

Monday, March 2, 2009

Page 12: Basic Game Frameworks

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

Page 13: Basic Game Frameworks

Storyboard/Prototype

Introduction screen to provide instructions and initiate play and clicking play button.

Game movie clip. A matching game has been selected based on planning discussions around theme selection. Existing game may serve as template.

Game over and debrief screen. In the case of the matching game, this includes players final score, time, and button to play again.

Monday, March 2, 2009

Page 14: Basic Game Frameworks

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

Page 15: Basic Game Frameworks

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

Page 16: Basic Game Frameworks

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

Page 17: Basic Game Frameworks

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

Page 18: Basic Game Frameworks

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

Page 19: Basic Game Frameworks

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

Page 20: Basic Game Frameworks

Lab and Group Work

Monday, March 2, 2009