memory deduction games

27
Brain Games Working with Arrays and Game Objects IT 7220 - March 9, 2009 1 Monday, March 9, 2009

Upload: indiana-state-university

Post on 22-Jan-2015

1.198 views

Category:

Technology


2 download

DESCRIPTION

A look at brain games for memory and deduction, created in Flash.

TRANSCRIPT

  • 1. Brain GamesWorking with Arrays and Game ObjectsIT 7220 - March 9, 2009 Monday, March 9, 2009 1

2. AgendaSyllabus Updates A word about the Midterm Guest Lecturer March 23 Quick poll Greeting Cards Rosenzweig Chap 4 - Memory and Deduction GamesHOT: Publishing in Flash; Perkins Chap 17 Lab and Group Work Monday, March 9, 20092 3. Midterm - March 23 Two Parts: An essay part where you will submit a Word document A Flash part where you will submit a Flash movieMonday, March 9, 20093 4. Guest Lecturer Dr. Moon-Heum Cho Candidate for our tenure-track faculty search Will talk for 1-hour before the exam Would like to know something about you Monday, March 9, 20094 5. Quick PollBy a show of hands: How many Doctoral students? How many Masters students? How many EdSpec students? How many non-IT majors? Monday, March 9, 2009 5 6. Greeting Cardshttp://itlab2.coe.wayne.edu/tboileau/IT7220WI09/GreetingCard/index.html PointsCriterionavailableCreate a greeting card using Flash50The card must include text and graphics 10Provide a way to navigate back and forth between 15 pages (if a 2-page card) or replay (if an animation) Publish and upload the html & .swf files to our web 15 serverSend the .fla file to me via Blackboard 10Total100 Monday, March 9, 20096 7. Rosenzweig Chap 4Two game shell frameworks are provided: Simple memory game - player watches and repeats a sequence Deductive logic game - feedback is provided to get better on each turnBoth frameworks rely on the use of data structures to keep track of game elementsPrincipal data structures are arrays and objects Monday, March 9, 2009 7 8. Arrays as Data StructuresRecall that an array in ActionScript is used tostore a list of values; ex: a list of charactersArrays can store many types of objects including display objects such as movie clips and sprites (e.g., matching game inChapter 3)You can also mix the types of types of values stored in arrays for example: [7, Hello]Arrays are a common and indispensable data structure for gamesMonday, March 9, 20098 9. Common Array Functions Function Example Description push myArray.push(Wizard)Adds a value to the end of an array Removes the last value of an array and popmyArray.pop()returns itunshiftmyarray.unshift(Wizard) Adds a value to the beginning of and array Removes the rst value in an array and shiftmyArray.shift(Wizard)returns itmyArray.splice(7,2,Wizard, Removes items from a location in the array spliceBard)and inserts new items thereReturns the location of an item, or -1 if it is indexOfmyArray.indexOf(Rogue)not foundsort myArray.sort()Sorts an array Monday, March 9, 20099 10. Data ObjectsData objects are used when we need to keeptrack of (and store) multiple attributes inorder to describe an object using dot syntax.An example in a game is character type, leveland health Objects are dynamic: you can add new properties whenever you need to Properties can be of any variable type and do not need to be assigned; you just need to assign a value to them as in the exampleMonday, March 9, 2009 10 11. Data Objects and Arrays Data objects and arrays work well together Objects organize all of the attributes and methods needed to describe and use a thingArrays help to organize and keep track of collections of objects in a gameMonday, March 9, 2009 11 12. Memory Game Monday, March 9, 2009 12 13. Memory Game Source: http://www.freegames.ws/games/kidsgames/simon/simon.htmMonday, March 9, 2009 13 14. Memory Game MemoryGame.aMemoryGame.asMonday, March 9, 200914 15. Memory GameActionScript les (game class) are starting to get a little longer--this one is 167 linesCode is arranged in logical blocks Design rationale and description by Rosenzweig is provided in the textTips for modifying the basic game are on page 137 Monday, March 9, 2009 15 16. Deduction GameGame concept comes from a 2- player board gameOriginal concept dates back over a 100 years to a gamecalled Bulls and CowsObject is to place ve colored pegs in sequence to match ahidden pattern (code) usingdeductive logicInvolves strategy to break the code in the least number ofturnsMonday, March 9, 2009 16 17. Other Deduction Games Monday, March 9, 2009 17 18. Deduction Game http://www.netrover.com/~jjrose/deduction/deduction.htmlMonday, March 9, 200918 19. Deduction GameDeduction.aDeduction.as Monday, March 9, 200919 20. Deduction GameMore robust strategy, similar to matching game i.e., 3 frames are used: intro, play, gameoverDeduction game class contains about 200 lines of codeCode is arranged in logical blocks Design rationale and description by Rosenzweig is provided in the textGame is modiable to support use of different story lines and graphics in adventure game genre Monday, March 9, 2009 20 21. HOT: Publishing in FlashWe have already talked about publish settings, underthe le menu in FlashFlash allows for publishing content in a variety ofoptions including: Web, CD,EXE/APP, QuickTime, andas image lesPublish proles can be created for different projecttypesMonday, March 9, 200921 22. HOT: Publishing FormatsTabs available in publish settings are determined bythe outputs selected Projector functionality is controlled usingfscommand(), typically inrst frame of movie (seeexercise 3 p 476 and tableon p 479)Monday, March 9, 2009 22 23. HOT: Publishing FlashSelect Top Down load order to load layers fromtop--best practice is to placeAS in top layerSelect Protect from import to discourage people fromgaining access to your codeGenerate size report provides a frame-by-framereport of the size of allobjects in your projectMonday, March 9, 2009 23 24. HOT: Size ReportSize report forDeduction.a Monday, March 9, 200924 25. HOT: Publishing HTMLSetting Dimensions to Percent allow the SWF leto scale with the HTMLpage it is opened within Setting Dimensions to Match Movie sets theHTML tags to the size ofthe stage Monday, March 9, 200925 26. HOT: Publishing Summary Flash provides the ability to export graphics as image lesPublish settings are summarized on pp 484-493Perkins provides guidelines for optimizing movies on pp 494-495Monday, March 9, 2009 26 27. Lab and Group Work Monday, March 9, 200927