Programming games Share your plans for your virtual something.

Slides:



Advertisements
Similar presentations
HTML popo.
Advertisements

OMT II Mam Saima Gul. * Static web page * a web page with contents that remain fixed and unchanged once it has been created by the author Web server Client.
Cascading Style Sheets. CSS stands for Cascading Style Sheets and is a simple styling language which allows attaching style to HTML elements. CSS is a.
Programming games Classwork: Show Favorite Sites. Show coin toss. Review concepts. Crooked coin toss. Homework: Complete coin toss examples. Upload files.
Programming games More drawing. Text. Radian measure. Faces. Homework: Do your own drawings. Create index.html file. Upload work.
Programming games Reprise on dice game and alternative dice game Homework: [Catch up.]. Finish dice game.
CIS101 Introduction to Computing
Computing Concepts Advanced HTML: Tables and Forms.
ObjectDraw and Objects Early Chris Nevison Barbara Wells.
Creating a Web Page HyperText Markup Language. HTML Documents  Created using any text editor  Notepad  Vi, Pico, or Emacs  If using word-processor,
ULI101: XHTML Basics (Part III) Introduction to XHTML / Continued … Block-Level vs. Inline Elements (tags) Manipulating Text,  , Text Characteristics,,,,,,,,,,,,,,,
Programming Games Computer science big ideas. Computer Science jargon. Show virtual dog Homework: [Catch up: dice game, credit card or other form.] Plan.
HTML Overview Part 2 – Paragraphs, Headings, and Lines 1.
Programming Games Review for midterm. Work session. Homework: Prepare for midterm.
Programming games Recap. Upload work (Filezilla, index.html). Drawing lines. Drawing stars. Homework: Drawing exercises.
Section 4.1 Format HTML tags Identify HTML guidelines Section 4.2 Organize Web site files and folder Use a text editor Use HTML tags and attributes Create.
DHTML AND JAVASCRIPT Genetic Computer School LESSON 2 HTML TAGS G H E F.
Programming Games Google Map API examples. CSS. Classwork/homework: Catch up. Upload work. Show your [more] complex Google Maps API example. Plan your.
Programming Games Simulated ballistic motion: cannon ball. Classwork: Final day for midterm project and all projects for first part of class. Homework:
Programming games Reprise: coin toss on canvas. Dice game rules. Global and local variables. Homework: [Catch up. Upload projects, including index.html.]
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Programming Games Show project. Refresher on coordinates. Scaling, translation. HTML5 logo. Refresher on animation. Bouncing ball. Homework: Do your own.
Chapter 2 Web Page Design Mr. Gironda. Elements of a Web Page These are things that most web pages use.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Variables, Functions and Events (there is an audio component to this eLesson) © Dr.
Programming games Show shaking screen, quiz show. Calculations Homework: (Finish basic Javascript Projects) Make proposal. Work on project.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
Creating Web Documents catch-up JavaScript slide show tools redirection.
Programming games Show your virtual somethings. Demonstrate Hangman and Black Jack. Show credit card (or other form input & calculation) Homework: [Complete.
Programming games Context of what we are doing. Drawing on canvas. Homework: [Complete coin toss examples.] Do your own drawings. Upload files to website.
Programming Games Logic. Slide show. Range input. Storage. Datatypes. Binary numbers. Homework: Catch up. This includes uploading projects to your server.
Programming games Review concepts. Crooked coin toss. Drawing on canvas. Homework: Complete [static] drawings. Upload files to website.
Computer Science I Share plans for virtual something. Text. Show my virtual dog. Classwork: Plans for your virtual something. Homework: start implementation.
Creating Web Documents: JavaScript Ftp / file management: review Introduction to JavaScript Sources Homework: start review for midterm, work on Project.
Programming Games Reprise: credit cards. Show video projects. Demonstrate Find Daniel and Virtual Dog. Homework: [Catch up.] Post proposal for your JavaScript.
Revision Webpage design HTML.   FACE  Attributes  Marquee  Define the following terms.
Programming games Show work on site. Work on slide show. Timed event for bouncing ball. Homework: [Finish slide show and upload to site.] Acquire a short.
Creating Web Documents CSS examples (do more later) Lab/Homework: Read chapters 15 & 16. Work on Project 3, do postings.
Introduction to HTML.
HTML Basics.
Section 4.1 Section 4.2 Format HTML tags Identify HTML guidelines
Creating Web Documents
What is a Function Expression?
SVG & DOM Manipulation via Javascript
Programming Games Work / finish and show dice game. Extras. Timed events. ftp. index file. Homework: Catch up and do slide show.
Classwork: Examine and enhance falling drop(s) or make your own.
JavaScript is a programming language designed for Web pages.
Microsoft® Office FrontPage® 2003 Training
JavaScript functions.
Using Cascading Style Sheets Module B: CSS Structure
JavaScript: Functions.
JavaScript.
Revision.
Programming Games Computer science big ideas and Computer Science jargon: review of things we have used in examples. Show virtual dog Homework: [Catch.
Event Driven Programming & User Defined Functions
Using HTML Tables SWBAT: - create tables using HTML
Tutorial 6 Creating Dynamic Pages
The Web Wizard’s Guide To JavaScript
Programming games Classes and objects (used for Jigsaw, Bouncing stuff, other projects) Homework: Complete cannonball. Video or Audio. Your own project.
Introduction to HTML5.
Teaching slides Chapter 6.
Pertemuan 1b
Context of what we are doing.
Moodle Training — Advanced Topics —
Exercise 24 – Software Skills
JavaScript Basics What is JavaScript?
Chapter 7 Event-Driven Pages
Catchup. Work on project.
Programming Games Refresher on coordinates. Scaling, translation. HTML5 logo. Refresher on animation. Bouncing ball. Show project. Classwork/Homework:
Web Programming and Design
Programming games Reprise on dice game and alternative dice game
Presentation transcript:

Programming games Share your plans for your virtual something. Homework: Catch up. Complete your virtual something.

Function Functions are one or more statements packaged together defined to be used later. The format for defining a function in JavaScript is function the_name_given_by_programmer (zero, or some number of names for parameters) { One or more statements }

Example function convertCtoF (cen) { return cen*(9.0/5.0) + 32.0; } Look back at examples with init, toss, change

Calling a function Aka invoking, executing Various ways, including By itself as a statement: startup(); In an expression: total = cost + ctax(cost); As value of attribute in html tag, these set up a call for later <body onload="init();"> <button onclick="toss();"> As event handler td = setInterval(moveit,100); canvas1.addEventListener("click",toss,false);

Recommend Review the code for your projects and notice use of functions. Look up functions online Go to Library and look at my books on reserve Try codeacademy

Planning … is a good thing to do! It is real work. Formal systems / commercial products for systems design Note: most work is not 'green fields', ab initio… but enhancements & fixes.

Share plans for virtual something ???

Discrete simulation Discrete as opposed to continuous. Determinations / calculations done at timed intervals using setInterval Reference & modify internal variables May change images (src of img elements) May change canvas

State Variables values with names Global outside of any function and so accessible by all functions persistent: stay around My Virtual Dog: weight of the dog. You may have more than 1 state variable. You also may have information in form fields or other html displayed to the viewer/player.

Checking conditions You can use if statements including nested if statements switch statements

Jargon Stochastic: factor involving some level of chance. Note: In my virtual dog, the formula varied from being 10% likely to produce snarly dog to 90% likely. Discrete simulation: calculations done at fixed intervals of time. NOT continuously. Persistent: stays around… Applied to variables. Global variables, variables with var statement outside of any function, stay around…

Size of images An img tag can include width and/or height attributes OR NOT If nothing specified, the width and height of the image file is used. If just width or just height, the other is calculated to keep aspect ratio. It makes sense to set at least height in the slideshow. Pixel is a small unit of length on the screen. Experiment !

Recommended Style section for formatting Script section for dynamic behavior Body section for content (structured content)

<html> <head> <style>. alignright {float:right} <html> <head> <style> .alignright {float:right} .alignleft {float:left} section {width: 50% } </style> </head>

<body> <section> Here is some text that will take up some of the space. The hr (stands for horizontal rule) shows how wide the section is. <hr/> <img class="alignright" width="100" src="head.jpg"/> <img class="alignleft" src="tail.jpg" width="100" /> </section> </body> </html>

Virtual something: Keep it simple,… At least for now: At least 2 actions No more states than my virtual dog, and it can be less. Focus on logic. Can improve graphics later.

General point What is the minimum you need to do to test your plan? Do this first and then add…. 3-4 images in slide show 3 states, 1 action in virtual something What is the minimum you need to do to satisfy the assignment? 5-6 states, 2 actions, 1 stochastic factor, …

[partial] Ideas Perhaps for midterm project: combine virtual something with credit card? Man goes into a bar… Virtual something be drawn on canvas: easier to vary color, size, and content. Fill up screen with stars? Something else? ‘Ville, Sim type game: “buy” stuff. Add stochastic factor?

Misc. Filezilla is one product that performs FTP (file transfer protocol). There are others. This is what is used here. On your home computer, consider using Normal, as opposed to Ask for Password Do keep uploading work and updating your index.html file Give your virtual project an evocative name, NOT Virtual something

Consider Having possibility for game lasting forever OR NOT

Virtual something To keep a global variable such as weight from going above a certain amount weight = Math.min(weight,upperlimit); To keep it from going less than weight = Math.max(weight,lowerlimit);

Drawing on canvas May or may not use clearRect each time. Consider using drawImage and then drawImage for smaller images on top or beginPath(), …. stroke() on top Consider looking up bezierCurveTo or quadraticCurveTo in addition to arc

States May have parallel arrays holding information such as colors, sizes, positions, image files START SMALL

Classwork / homework Get caught up Build your virtual something. This includes uploading work and modifying index.html page Build your virtual something. Note: you can build on this project for your midterm project.