Download presentation
Presentation is loading. Please wait.
Published byLoreen Fisher Modified over 9 years ago
1
Programming games Show your virtual somethings. Demonstrate Hangman and Black Jack. Show credit card (or other form input & calculation) Homework: [Complete your virtual something.] Study midterm guide and come to class with questions.
2
Virtual dog: Discrete simulation Check and, possibly, change state at discrete intervals of time. Note: Can combine with event based programming –do actions, including checks, when events happen State can include: internal state variables, src settings for img on document, OR draw on canvas, change location of elements in the document. –more on this later
3
Discrete simulation Used for many things, including –Weather. What goes on each interval is solution of a small number (~6) equations involving 3-D grid of the world! –Traffic. –Medicine / biology –Manufacturing –….
4
One way of handling animated gifs http://faculty.purchase.edu/jeanine.meyer/te stgif.html Notice check if the gif has been started already. The function setInterval returns a new number each time.
5
Hangman Combine dynamically created markup with drawings on canvas. External script file used to hold word list. http://faculty.purchase.edu/jeanine.meyer/ html5/hangman3.htmlhttp://faculty.purchase.edu/jeanine.meyer/ html5/hangman3.html
6
function drawhead() { ctx.lineWidth = 3; ctx.strokeStyle = facecolor; ctx.save(); //before scaling of circle to be oval ctx.scale(.6,1); ctx.beginPath(); ctx.arc (bodycenterx/.6,80,10,0,Math.PI*2,fa lse); ctx.stroke(); ctx.closePath(); ctx.restore(); }
7
.letters {position:absolute;left: 0px; top: 0px; border: 2px; border-style: double; margin: 5px; padding: 5px; color:#F00; background-color:#0FC; font- family:"Courier New", Courier, monospace; }.blanks {position:absolute;left: 0px; top: 0px; border:none; margin: 5px; padding: 5px; color:#006; background-color:white; font-family:"Courier New", Courier, monospace; text-decoration:underline; color: black; font-size:24px; }
8
Black Jack more drawing of images, text on canvas, shuffling, capture key presses –http://faculty.purchase.edu/jeanine.meyer/html 5/blackjack.htmlhttp://faculty.purchase.edu/jeanine.meyer/html 5/blackjack.html Note use of footer for giving credit.
9
Classwork / Homework Catch up. Show work. If you aren't done (remember it can be simple), complete your virtual something. Start studying for midterm. –Come to class with questions.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.