Memory Deduction Games


Published on

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

  • Be the first to comment

  • Be the first to like this

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

No notes for slide

Memory Deduction Games

  1. 1. Brain Games Working with Arrays and Game Objects IT 7220 - March 9, 2009 Monday, March 9, 2009 1
  2. 2. Agenda Syllabus Updates ✦ A word about the Midterm ✦ Guest Lecturer March 23 ✦ Quick poll ✦ Greeting Cards ✦ Rosenzweig Chap 4 - Memory and Deduction ✦ Games HOT: Publishing in Flash; Perkins Chap 17 ✦ Lab and Group Work ✦ Monday, March 9, 2009 2
  3. 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 ✦ movie Monday, March 9, 2009 3
  4. 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, 2009 4
  5. 5. Quick Poll By a show of hands: How many Doctoral students? ✦ How many Master’s students? ✦ How many EdSpec students? ✦ How many non-IT majors? ✦ Monday, March 9, 2009 5
  6. 6. Greeting Cards IT7220WI09/GreetingCard/index.html Points Criterion available Create a greeting card using Flash 50 The card must include text and graphics 10 Provide 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 server Send the .fla file to me via Blackboard 10 Total 100 Monday, March 9, 2009 6
  7. 7. Rosenzweig Chap 4 Two 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 turn Both frameworks rely on the use of data ✦ structures to keep track of game elements Principal data structures are arrays and objects ✦ Monday, March 9, 2009 7
  8. 8. Arrays as Data Structures Recall that an array in ActionScript is used to store a list of values; ex: a list of characters Arrays can store many types of objects including display ✦ objects such as movie clips and sprites (e.g., matching game in Chapter 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 ✦ games Monday, March 9, 2009 8
  9. 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 pop myArray.pop() returns it unshift myarray.unshift(“Wizard”) Adds a value to the beginning of and array Removes the first value in an array and shift myArray.shift(“Wizard”) returns it myArray.splice(7,2,”Wizard”, Removes items from a location in the array splice ”Bard”) and inserts new items there Returns the location of an item, or -1 if it is indexOf myArray.indexOf(“Rogue”) not found sort myArray.sort() Sorts an array Monday, March 9, 2009 9
  10. 10. Data Objects Data objects are used when we need to keep track of (and store) multiple attributes in order to describe an object using dot syntax. An example in a game is character type, level and 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 example Monday, March 9, 2009 10
  11. 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 thing Arrays help to organize and keep track of ✦ collections of objects in a game Monday, March 9, 2009 11
  12. 12. Memory Game Monday, March 9, 2009 12
  13. 13. Memory Game Source: Monday, March 9, 2009 13
  14. 14. Memory Game MemoryGame.fla Monday, March 9, 2009 14
  15. 15. Memory Game ActionScript files (game class) are starting to ✦ get a little longer--this one is 167 lines Code is arranged in logical blocks ✦ Design rationale and description by ✦ Rosenzweig is provided in the text Tips for modifying the basic game are on page ✦ 137 Monday, March 9, 2009 15
  16. 16. Deduction Game Game concept comes from a 2- ✦ player board game Original concept dates back ✦ over a 100 years to a game called “Bulls and Cows” Object is to place five colored ✦ pegs in sequence to match a hidden pattern (code) using deductive logic Involves strategy to break the ✦ “code” in the least number of turns Monday, March 9, 2009 16
  17. 17. Other Deduction Games Monday, March 9, 2009 17
  18. 18. Deduction Game Monday, March 9, 2009 18
  19. 19. Deduction Game Deduction.fla Monday, March 9, 2009 19
  20. 20. Deduction Game More robust strategy, similar to matching game i.e., ✦ 3 frames are used: intro, play, gameover Deduction game class contains about 200 lines of ✦ code Code is arranged in logical blocks ✦ Design rationale and description by Rosenzweig is ✦ provided in the text Game is modifiable to support use of different story ✦ lines and graphics in adventure game genre Monday, March 9, 2009 20
  21. 21. HOT: Publishing in Flash We have already talked ✦ about publish settings, under the file menu in Flash Flash allows for publishing ✦ content in a variety of options including: Web, CD, EXE/APP, QuickTime, and as image files Publish profiles can be ✦ created for different project types Monday, March 9, 2009 21
  22. 22. HOT: Publishing Formats Tabs available in publish ✦ settings are determined by the outputs selected Projector functionality is ✦ controlled using fscommand(), typically in first frame of movie (see exercise 3 p 476 and table on p 479) Monday, March 9, 2009 22
  23. 23. HOT: Publishing Flash Select “Top Down” load ✦ order to load layers from top--best practice is to place AS in top layer Select “Protect from import” ✦ to ‘discourage’ people from gaining access to your code “Generate size report” ✦ provides a frame-by-frame report of the size of all objects in your project Monday, March 9, 2009 23
  24. 24. HOT: Size Report Size report for Deduction.fla Monday, March 9, 2009 24
  25. 25. HOT: Publishing HTML Setting Dimensions to ✦ Percent allow the SWF file to scale with the HTML page it is opened within Setting Dimensions to ✦ Match Movie sets the HTML tags to the size of the stage Monday, March 9, 2009 25
  26. 26. HOT: Publishing Summary Flash provides the ability to export graphics as ✦ image files Publish settings are summarized on pp ✦ 484-493 Perkins provides guidelines for optimizing ✦ movies on pp 494-495 Monday, March 9, 2009 26
  27. 27. Lab and Group Work Monday, March 9, 2009 27