SlideShare una empresa de Scribd logo
1 de 27
Descargar para leer sin conexión
Brain Games
               Working with Arrays and Game Objects
                         IT 7220 - March 9, 2009




Monday, March 9, 2009                                 1
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
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
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
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
Greeting Cards
                   http://itlab2.coe.wayne.edu/tboileau/
                   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
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
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
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
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
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
Memory Game




Monday, March 9, 2009                 12
Memory Game




      Source: http://www.freegames.ws/games/kidsgames/simon/simon.htm

Monday, March 9, 2009                                                   13
Memory Game




          MemoryGame.fla        MemoryGame.as

Monday, March 9, 2009                          14
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
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
Other Deduction Games




Monday, March 9, 2009               17
Deduction Game




                        http://www.netrover.com/~jjrose/deduction/deduction.html

Monday, March 9, 2009                                                              18
Deduction Game




                   Deduction.fla
                   Deduction.as
Monday, March 9, 2009                    19
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
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
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
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
HOT: Size Report
                   Size report for
                   Deduction.fla




Monday, March 9, 2009                      24
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
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
Lab and Group Work




Monday, March 9, 2009                    27

Más contenido relacionado

Similar a Brain Games: Working with Arrays and Game Objects

Sqlpo Presentation
Sqlpo PresentationSqlpo Presentation
Sqlpo Presentationsandook
 
Objective-C A Beginner's Dive (with notes)
Objective-C A Beginner's Dive (with notes)Objective-C A Beginner's Dive (with notes)
Objective-C A Beginner's Dive (with notes)Altece
 
Objective-C A Beginner's Dive
Objective-C A Beginner's DiveObjective-C A Beginner's Dive
Objective-C A Beginner's DiveAltece
 
Using Objects to Organize your jQuery Code
Using Objects to Organize your jQuery CodeUsing Objects to Organize your jQuery Code
Using Objects to Organize your jQuery CodeRebecca Murphey
 
Machine Learning Live
Machine Learning LiveMachine Learning Live
Machine Learning LiveMike Anderson
 
Apache Hadoop Talk at QCon
Apache Hadoop Talk at QConApache Hadoop Talk at QCon
Apache Hadoop Talk at QConCloudera, Inc.
 
Lessons I Learned While Scaling to 5000 Puppet Agents
Lessons I Learned While Scaling to 5000 Puppet AgentsLessons I Learned While Scaling to 5000 Puppet Agents
Lessons I Learned While Scaling to 5000 Puppet AgentsPuppet
 
Bucc Toy Project: Learn programming through Game Development
Bucc  Toy Project: Learn programming through Game DevelopmentBucc  Toy Project: Learn programming through Game Development
Bucc Toy Project: Learn programming through Game DevelopmentSadaf Noor
 
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meetMacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meetMatt Aimonetti
 
The State of Puppet
The State of PuppetThe State of Puppet
The State of PuppetPuppet
 
Instance-based learning (aka Case-based or Memory-based or non-parametric)
Instance-based learning (aka Case-based or Memory-based or non-parametric)Instance-based learning (aka Case-based or Memory-based or non-parametric)
Instance-based learning (aka Case-based or Memory-based or non-parametric)guestfee8698
 
Rust: Reach Further (from QCon Sao Paolo 2018)
Rust: Reach Further (from QCon Sao Paolo 2018)Rust: Reach Further (from QCon Sao Paolo 2018)
Rust: Reach Further (from QCon Sao Paolo 2018)nikomatsakis
 

Similar a Brain Games: Working with Arrays and Game Objects (20)

Sqlpo Presentation
Sqlpo PresentationSqlpo Presentation
Sqlpo Presentation
 
Owasp Au Rev4
Owasp Au Rev4Owasp Au Rev4
Owasp Au Rev4
 
Advanced Action Script
Advanced Action ScriptAdvanced Action Script
Advanced Action Script
 
Objective-C A Beginner's Dive (with notes)
Objective-C A Beginner's Dive (with notes)Objective-C A Beginner's Dive (with notes)
Objective-C A Beginner's Dive (with notes)
 
Objective-C A Beginner's Dive
Objective-C A Beginner's DiveObjective-C A Beginner's Dive
Objective-C A Beginner's Dive
 
Using Objects to Organize your jQuery Code
Using Objects to Organize your jQuery CodeUsing Objects to Organize your jQuery Code
Using Objects to Organize your jQuery Code
 
Machine Learning Live
Machine Learning LiveMachine Learning Live
Machine Learning Live
 
Playing With Ruby
Playing With RubyPlaying With Ruby
Playing With Ruby
 
20090309berkeley
20090309berkeley20090309berkeley
20090309berkeley
 
Apache Hadoop Talk at QCon
Apache Hadoop Talk at QConApache Hadoop Talk at QCon
Apache Hadoop Talk at QCon
 
Lessons I Learned While Scaling to 5000 Puppet Agents
Lessons I Learned While Scaling to 5000 Puppet AgentsLessons I Learned While Scaling to 5000 Puppet Agents
Lessons I Learned While Scaling to 5000 Puppet Agents
 
Bucc Toy Project: Learn programming through Game Development
Bucc  Toy Project: Learn programming through Game DevelopmentBucc  Toy Project: Learn programming through Game Development
Bucc Toy Project: Learn programming through Game Development
 
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meetMacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
 
The State of Puppet
The State of PuppetThe State of Puppet
The State of Puppet
 
06 data
06 data06 data
06 data
 
55 New Features in Java 7
55 New Features in Java 755 New Features in Java 7
55 New Features in Java 7
 
Trivia/Quiz Games
Trivia/Quiz GamesTrivia/Quiz Games
Trivia/Quiz Games
 
Spring ME
Spring MESpring ME
Spring ME
 
Instance-based learning (aka Case-based or Memory-based or non-parametric)
Instance-based learning (aka Case-based or Memory-based or non-parametric)Instance-based learning (aka Case-based or Memory-based or non-parametric)
Instance-based learning (aka Case-based or Memory-based or non-parametric)
 
Rust: Reach Further (from QCon Sao Paolo 2018)
Rust: Reach Further (from QCon Sao Paolo 2018)Rust: Reach Further (from QCon Sao Paolo 2018)
Rust: Reach Further (from QCon Sao Paolo 2018)
 

Más de University of West Florida

Digital Curation and Methods for Teaching Digital Literacy Skills
Digital Curation and Methods for Teaching Digital Literacy SkillsDigital Curation and Methods for Teaching Digital Literacy Skills
Digital Curation and Methods for Teaching Digital Literacy SkillsUniversity of West Florida
 
Technology Applications in Education and Training
Technology Applications in Education and TrainingTechnology Applications in Education and Training
Technology Applications in Education and TrainingUniversity of West Florida
 

Más de University of West Florida (20)

PLN4PD
PLN4PDPLN4PD
PLN4PD
 
Universities Without Borders
Universities Without BordersUniversities Without Borders
Universities Without Borders
 
Media literacy workshop
Media literacy workshopMedia literacy workshop
Media literacy workshop
 
#svjun26 South Vermillion Community Schools
#svjun26 South Vermillion Community Schools#svjun26 South Vermillion Community Schools
#svjun26 South Vermillion Community Schools
 
Digital Curation and Methods for Teaching Digital Literacy Skills
Digital Curation and Methods for Teaching Digital Literacy SkillsDigital Curation and Methods for Teaching Digital Literacy Skills
Digital Curation and Methods for Teaching Digital Literacy Skills
 
Applying Game Concepts To Learning
Applying Game Concepts To LearningApplying Game Concepts To Learning
Applying Game Concepts To Learning
 
MOOCs: Fact vs. Myth
MOOCs: Fact vs. MythMOOCs: Fact vs. Myth
MOOCs: Fact vs. Myth
 
Introduction to Games and Simulations
Introduction to Games and SimulationsIntroduction to Games and Simulations
Introduction to Games and Simulations
 
Social Learning
Social LearningSocial Learning
Social Learning
 
Learning Verses Experience
Learning Verses ExperienceLearning Verses Experience
Learning Verses Experience
 
Technology Applications in Education and Training
Technology Applications in Education and TrainingTechnology Applications in Education and Training
Technology Applications in Education and Training
 
Social Learning Part B
Social Learning Part BSocial Learning Part B
Social Learning Part B
 
Social Learning Part A
Social Learning Part ASocial Learning Part A
Social Learning Part A
 
Social Communities
Social CommunitiesSocial Communities
Social Communities
 
The Social Web
The Social WebThe Social Web
The Social Web
 
Flash Word Games
Flash Word GamesFlash Word Games
Flash Word Games
 
Time-based Animation Games
Time-based Animation GamesTime-based Animation Games
Time-based Animation Games
 
Learning Game Implementation
Learning Game ImplementationLearning Game Implementation
Learning Game Implementation
 
Game Design Process
Game Design ProcessGame Design Process
Game Design Process
 
Design Strategy
Design StrategyDesign Strategy
Design Strategy
 

Último

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 

Último (20)

Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 

Brain Games: Working with Arrays and Game Objects

  • 1. Brain Games Working with Arrays and Game Objects IT 7220 - March 9, 2009 Monday, March 9, 2009 1
  • 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. 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. 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. 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. Greeting Cards http://itlab2.coe.wayne.edu/tboileau/ 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. 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. 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. 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. 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. 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
  • 13. Memory Game Source: http://www.freegames.ws/games/kidsgames/simon/simon.htm Monday, March 9, 2009 13
  • 14. Memory Game MemoryGame.fla MemoryGame.as Monday, March 9, 2009 14
  • 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. 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. Other Deduction Games Monday, March 9, 2009 17
  • 18. Deduction Game http://www.netrover.com/~jjrose/deduction/deduction.html Monday, March 9, 2009 18
  • 19. Deduction Game Deduction.fla Deduction.as Monday, March 9, 2009 19
  • 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. 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. 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. 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. HOT: Size Report Size report for Deduction.fla Monday, March 9, 2009 24
  • 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. 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. Lab and Group Work Monday, March 9, 2009 27