1 / 9

Programming Games

Programming Games. Show Virtual somethings. Review for midterm. Work session. Homework: Prepare for midterm. Research test. Write JavaScript code to change a certain img picture to classday.gif if it is Monday or Thursday. Fill in the ????. Write your source. d = new Date();

alimon
Télécharger la présentation

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 Show Virtual somethings. Review for midterm. Work session. Homework: Prepare for midterm

  2. Research test Write JavaScript code to change a certain img picture to classday.gif if it is Monday or Thursday. Fill in the ????. Write your source. d = new Date(); if ( ???? ) {place.src="classday.gif";} <body> <img name="place" src="notclass.gif"/>

  3. Midterm review • Read the guide. • Review ALL the lecture notes. • Ask questions • Come to office hours • ???

  4. Basic programming concepts • function • variable • datatype • event • array • operators • statements: assignment, if, for, switch, function call • notation (syntax): uses of parentheses, brackets, square brackets, pointy brackets

  5. HTML basics • style, script and body elements • element consists of opening tag, contents of element, ending/closing tag. • opening tag has a type and may have other attributes including name, id, etc. • certain tags have specific attributes • a has href • img has src

  6. Advice • Study midterm guide. The questions will be identical or strongly similar to these questions! • The midterm will NOT ask for large sections of code from the class projects.

  7. Advice: Programming • organization of code • function definitions and variables (var statements) in <script> element • structured content in <body> element • In some applications, HTML elements are created dynamically. • event handling (responding to player actions, time) • buttons: using <button> or <a> or Form containing <input type="submit"> element • setInterval, setTimer • addEventListener

  8. Advice: General • Plan: your design is independent of code, though when doing the coding, the design may evolve. • Work iteratively. Save with new names. Plan testing. • Make names meaningful to your program. • Distinguish names in html and names of internal variables and functions. • Avoid using the same name for different things. • Indent systematically for readability. JavaScript ignores it. • Note: Python uses indents, not { and } • Take advantage of tools: • Firefox: Web Console for catching syntactic errors plus incorrect names and missing files • Sublime: • save as .html to get color coding • Use Find • There are tools in other browsers and editors. • There are more debugging tools in Firefox and other browsers.

  9. Homework • Study for midterm. • come to office hours today. • email with questions. • Make proposal (to the forum on moodle) with a topic for your midterm project. • It can build on previous projects. ….or not. • It must be your work. • Work on your JavaScript project.

More Related