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.

Slides:



Advertisements
Similar presentations
COM311H Zheng, School of C&M, UUJ1 Dynamic Web Authoring JavaScript Basics (Array and Function)
Advertisements

The Web Warrior Guide to Web Design Technologies
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.
Web Development & Design Foundations with XHTML Chapter 14 Key Concepts.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
1 Events Lect 8. 2 Event-driven Pages one popular feature of the Web is its interactive nature e.g., you click on buttons to make windows appear e.g.,
Programming Games Computer science big ideas. Computer Science jargon. Show virtual dog Homework: [Catch up: dice game, credit card or other form.] Plan.
Create Interfaces College exercise. Continue HTML5: HTML5 logo, drawing images. Coin toss. Homework: acquire video & audio.
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.
Programming Games Basic HTML5 audio example. Catch-up. Work on basic video. Homework: Complete basic video.
Programming Games Show your cannonball. HTML5 video. Miro. Classwork/Homework: Acquire video, convert to multiple formats, and produce simple (just html)
Lesson 19. JavaScript errors Since JavaScript is an interpreted language, syntax errors will usually cause the script to fail. Both browsers will provide.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
Programming Games Simulated ballistic motion: cannon ball. Classwork: Final day for midterm project and all projects for first part of class. Homework:
Programming Games Show your simple video. More video examples. Audio. Classwork/Homework: Produce more complex video program.
Programming games Reprise: coin toss on canvas. Dice game rules. Global and local variables. Homework: [Catch up. Upload projects, including index.html.]
Lesson13. JavaScript JavaScript is an interpreted language, designed to function within a web browser. It can also be used on the server.
Client Side Programming with JavaScript Why use client side programming? Web sides built on CGI programs can rapidly become overly complicated to maintain,
Programming Games Show project. Refresher on coordinates. Scaling, translation. HTML5 logo. Refresher on animation. Bouncing ball. Homework: Do your own.
Programming games Flash drawing trick(s). Past due: Your completion of rock-paper-scissors) Classwork: Bouncing ball: read tutorial. Start coding.
Programming games Show your version of Bo the dog. Start cannonball Preview: video, audio work session (cannonball) Homework: Cannonball with ball in a.
Programming Games Preview Video & Audio. Work on cannonball. Homework: finish cannonball!
Chapter 7: DHTML: Object Model and Collections CIS 275—Web Application Development for Business I.
Programming Games Reprise on drawing on canvas. Jargon (concepts): objects. Demonstrate slingshot. Mouse events. Work on your cannonball. Homework: Finish.
Programming games Show shaking screen, quiz show. Calculations Homework: (Finish basic Javascript Projects) Make proposal. Work on project.
Programming Games [Show Google Maps project.] Demonstrate more examples. Classwork/Homework: Decide on final project. Post proposal to moodle.
Programming games HTML/JavaScript basics Functions, events, forms Classwork: [Show favorite sites.] Coin toss. Homework: GET WEB SPACE. Complete coin toss.
Computer Science and Software Engineering© 2014 Project Lead The Way, Inc. HTML5 Evolving Standards JavaScript.
Creating Web Documents catch-up JavaScript slide show tools redirection.
By Tharith Sriv. To write a web page you use: HHTML (HyperText Markup Language), AASP (Active Server Page), PPHP (HyperText Preprocessor), JJavaScript,
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.
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
Event Handling. Objectives Using event handlers Simulating events Using event-related methods.
Programming games Review concepts. Crooked coin toss. Drawing on canvas. Homework: Complete [static] drawings. Upload files to website.
CIS 3.5 Lecture 2.3 "Introduction to JavaScript".
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 14 Key Concepts 1 Copyright © Terry Felke-Morris.
Creating User Interfaces HTML5 video & audio. Role of video and audio. Homework: Complete your own [small/simple] HTML5 video and audio projects.
Creating Web Documents: JavaScript Ftp / file management: review Introduction to JavaScript Sources Homework: start review for midterm, work on Project.
Javascript Overview. What is Javascript? May be one of the most popular programming languages ever Runs in the browser, not on the server All modern browsers.
Programming Games Show slide show (on your site). Bouncing something. Video element. Bouncing video element. Bouncing video drawn on canvas. Bouncing video.
CSS IS A LANGUAGE DESIGNED TO TARGET HTML ELEMENTS AND NODES BY TYPE, CLASS, ID AND VALUE, AND CHANGE THEIR VALUES CSS – change how your HTML looks and.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
Functions Wouldn’t it be nice to be able to bring up a new animal and paragraph without having to reload the page each time? We can! We can place the.
Copyright © Terry Felke-Morris Web Development & Design Foundations with HTML5 8 th Edition CHAPTER 14 KEY CONCEPTS 1 Copyright.
Programming Games Work / finish and show dice game. Extras. Timed events. ftp. index file. Homework: Catch up and do slide show.
Web Development & Design Foundations with HTML5
Week 4: Introduction to Javascript
Donna J. Kain, Clarkson University
Barb Ericson Georgia Institute of Technology May 2006
Section 17.1 Section 17.2 Add an audio file using HTML
Web Development & Design Foundations with HTML5 7th Edition
Programming Games Computer science big ideas and Computer Science jargon: review of things we have used in examples. Show virtual dog Homework: [Catch.
Programming Games [Show Google Maps project.] Demonstrate more examples. Classwork/Homework: Decide on final project. Post proposal to moodle. 1.
Your 1st Programming Assignment
Context of what we are doing.
For this assignment, copy and past the XHTML to a notepad file with the .html extension. Then add the code I ask for to complete the problems.
Tutorial 10: Programming with javascript
Programming games Share your plans for your virtual something.
Catchup. Work on project.
Programming Games Reprise on drawing on canvas. Jargon (concepts): objects. Demonstrate slingshot. Mouse events. Work on animation project. Homework: Finish.
Programming Games Refresher on coordinates. Scaling, translation. HTML5 logo. Refresher on animation. Bouncing ball. Show project. Classwork/Homework:
Web Programming and Design
Web Programming and Design
Web Programming and Design
Show your animation project. HTML5 video. Miro.
Presentation transcript:

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 video clip.

ftp We will go around to check that you have uploaded something…. Preference is that you set up an index.html file so I (and anyone else) just goes to students.purchase.edu/john.doe –index.html files can be in any folder / multiple folders students.purchase.edu/john.doe/pg Your userid.

Game Review Design screen (game board) –static elements –dynamic elements image changes position changes Identify events and program event handlers Determine data (global variables)

HTML/JavaScript Review HTML head element contains –style element –script for functions and global variables setInterval used for timed events HTML body element contains –images –a element for javascript code as value of href, onMouseOver, onMouseOut, onClick –forms javascript code for onSubmit input elements for input from player AND output (display) to player –canvas element or elements

General hints Syntax (punctuation for code) counts! Watch for correct 'pairing up' of parentheses, curly brackets, quotation marks. HTML and JavaScript names must be correct. Your names (for functions, variables, images, etc.) must be consistent.

Debugging Put in alert("Here in code, variable x is "+X ); statements Use Firefox (or Mozilla or Netscape) and under Tools Error Console –Remember to Clear old messages –Be sure you are testing the file you are correcting…. Work slowly: add functionality one 'thing' at a time. Read the whole tutorial. Don't (just) copy and paste all the code. Think where the code goes.

Timed events Once a timed event is set up, you can do anything…. Better said: write code for setting up timed event. Write code to do anything. Example: bouncing ball –Strategy: use init function as done in other drawing examples. Use setInterval. Erase and re-draw circle and box.

var ctx; var cwidth = 900; var cheight = 600; var ballrad = 50; var boxx = 20; var boxy = 30; var boxwidth = 850; var boxheight = 550; var boxboundx = boxwidth+boxx-ballrad; var boxboundy = boxheight+boxy-ballrad; var inboxboundx = boxx+ballrad; var inboxboundy = boxy+ballrad; var ballx = 150; var bally = 160; var ballvx = 2; var ballvy = 4;

function init(){ ctx = document.getElementById('canvas').getCo ntext('2d'); ctx.lineWidth = ballrad; setInterval(drawscene,50); }

function drawscene(){ ctx.clearRect(boxx,boxy,boxwidth,boxheight); moveandcheck(); ctx.beginPath(); ctx.arc(ballx,bally,ballrad,0,2*Math.PI,true); ctx.fill(); ctx.strokeStyle ="rgb(200,0,50)"; ctx.strokeRect(boxx,boxy,boxwidth,boxheight); //box }

function moveandcheck() { var nballx = ballx + ballvx; var nbally = bally +ballvy; if (nballx > boxboundx) { ballvx =-ballvx; nballx = boxboundx; } if (nballx < inboxboundx) { nballx = inboxboundx ballvx = -ballvx; } if (nbally > boxboundy) { nbally = boxboundy; ballvy =-ballvy; } if (nbally < inboxboundy) { nbally = inboxboundy; ballvy = -ballvy; } ballx = nballx; bally = nbally; }

This browser doesn't support the HTML5 canvas element.

After slide show You can bounce anything! In the drawscene function replace ctx.beginPath(); ctx.arc(ballx,bally,ballrad,0,2*Math.PI,true); ctx.fill(); You can change dimensions of box, ball, speed, etc. You can change colors. You can add code to start and stop, using slide show as a model.

Class work / Homework Catch up and continue uploading work to your site Complete slide show. –upload to site. This means the html file and all the image files for the slide show. Acquire short video clip. Will start bouncing something…