1 / 15

Programming games

Programming games. Examples. Classwork: work and show something of your final project. Homework: (finish…). States capitals game. Demonstrate. States capitals. This could be countries.

forbes
Download Presentation

Programming games

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming games Examples. Classwork: work and show something of your final project. Homework: (finish…)

  2. States capitals game • Demonstrate

  3. States capitals • This could be countries. • Find a map. Divide it up into individual instances. NOTE: don't change the origin/registration point of any state. So most states will have origin NOT on/in the state. • Set up parallel arrays holding • State name • Capital name • neighbors

  4. States capitals • Use radio buttons for questions. • Design interface—think about mouse clicks and text area. • Set up functions for asking question and functions can handling the event of the answer being given. • Check out tutorial.

  5. skier • Demonstrate

  6. skier • Mountain moves. The skier does not move down the mountain. • Use of arrow moves skier left and right. • Place gates • Determine how to see if skier misses a gate • Design decision: stop game immediately or keep score. • See tutorial. • See source code for iterative design: skier1, skier2, skier3, skier4

  7. String methods • How do you examine a part of a string? • Suppose you have a variable, course, coursename, holding something like MAT1420.45 or NME3440.45 • course.substr(0,3) will return "MAT" or "NME" • Course.substr(3,1) will return "1" or "3" Is this an upper-level course? if (Number(course.substr(3,1))>2) ….

  8. substr, continued • I used this in the radio button video play. • This worked (only) because I named the buttons according to a pattern (THAT I MADE UP) so that I/my code can detect and use something from the names!

  9. String methods • There are many, some consistency across different languages. • There is substr and substring. • QUIZ: do search to find out difference between these two string methods.

  10. How do you combine strings? • If variable bos holds "MAT", "NME", etc. and num holds "1420", "3440", etc. and section holds "20", "45", etc. then the full name of a course is ????? • Answer: use +

  11. Answer • course = bos+num+"."+section;

  12. SharedObject • Reprise: a version of cookies. Persistent data on the client computer. • Browser specific. • Used for behavioral marketing. • Demonstrate. http://faculty.purchase.edu/jeanine.meyer/as30/simpleso.html

  13. SharedObject • Store name-value pair • For complex data, need to do calculations to create one long string • split • Join • do search to find how these work. They are string methods.

  14. Map program • Request to have mouse move a hole/shadow over a Google Maps. • http://faculty.purchase.edu/jeanine.meyer/html5/mapshadow.html • Issues: • how to put canvas on top of div where the map goes • how to draw the mask (hint: use "rgba(r,b,g,.5)"; • how to manage events

  15. Homework • [Show projects] • [Make proposal for your project] • SHOW YOUR PROJECT • Study guide to final and come to my office with questions and come to class with questions.

More Related