Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Games Mouse position. Examples. Review for final quiz.

Similar presentations


Presentation on theme: "Programming Games Mouse position. Examples. Review for final quiz."— Presentation transcript:

1 Programming Games Mouse position. Examples. Review for final quiz.
Classwork: Catch up. Finish final project. Show notebook. Homework: Upload project(s). Update index.html and send me the link.

2 How to get the position of mouse on canvas
[See examples for use with touch.] Approach in early days required differences for different browsers. "Modern" way uses bounding rectangle: Global variable: canvasrect; In init function, canvas1 = document.getElementById("canvas"); canvasrect = canvas1.getBoundingClientRect();

3 Position of mouse, summary
Global variable: var canvasrect; In init function, canvas1 = document.getElementById("canvas"); canvasrect = canvas1.getBoundingClientRect(); In function set up to respond to a mouse event: function mousestart(ev) { sx = ev.clientX-canvasrect.left; sy = ev.clientY-canvasrect.top; …}

4 Silly bee eating game Use parts for your own game. Note: I added the alert at the start because I forgot how to play the game.

5 Braiding Demonstrate on desktop and on iPad.
Use what is termed "2 and ½ D " Liked the shaking. Note: you can view all the source code on a desktop computer.

6 Questions for final? Review guide for final. Review lecture charts.
Be on time.

7 Other computing courses
Introductory Computer Science I Introduction to Programming with Max Programming for Visual Artists Next semester Creating Databases for Web Applications Other: CS II, Data Structures, Creating User Interfaces, Networking & Security, Topics in Advanced Computing, Social Software, Mobile Media Math + computing: Calculus III, Numerical Analysis, OR & Data Science, Number Theory

8 Classwork/homework [Catch up] Show your final project! Upload work and
Update your index.html file and Send to me.


Download ppt "Programming Games Mouse position. Examples. Review for final quiz."

Similar presentations


Ads by Google