WebFund 2013F: Tutorial 8: Difference between revisions

From Soma-notes
No edit summary
No edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''This tutorial is not yet finalized'''
In this tutorial you will be modifying [https://homeostasis.scs.carleton.ca/~soma/webfund-2013f/letterpaint-demo.zip letterpaint-demo].  Note the client-side code is from [https://hacks.mozilla.org/2013/06/building-a-simple-paint-game-with-html5-canvas-and-vanilla-javascript/ this HTML5 canvas tutorial].
In this tutorial you will be modifying [https://homeostasis.scs.carleton.ca/~soma/webfund-2013f/letterpaint-demo.zip letterpaint-demo].  Note the client-side code is from [https://hacks.mozilla.org/2013/06/building-a-simple-paint-game-with-html5-canvas-and-vanilla-javascript/ this HTML5 canvas tutorial].


Line 9: Line 8:
* Then, add a quit button:
* Then, add a quit button:
** Add the button to the page in <tt>index.html</tt> (make it the letter Q) similar to the information and sound buttons.
** Add the button to the page in <tt>index.html</tt> (make it the letter Q) similar to the information and sound buttons.
** Style the quit button in a fashion similar to the info button in <tt>letterscript.css</tt> (look for the #infos attributes).  Note you will have to change the offset; otherwise the button will overlap with the info button.  (If you do not customize the CSS for the button at all, it will take on the default navbutton properties and overlap with the sound button.)
** Style the quit button in a fashion similar to the info button in <tt>letterpaint.css</tt> (look for the #infos attributes).  Note you will have to change the offset; otherwise the button will overlap with the info button.  (If you do not customize the CSS for the button at all, it will take on the default navbutton properties and overlap with the sound button.)
** In <tt>letterpaint.js</tt>:
** In <tt>letterpaint.js</tt>:
*** Add a quitbutton variable similar to the one for sound or info.
*** Add a quitbutton variable similar to the one for sound or info.

Latest revision as of 16:09, 25 October 2013

In this tutorial you will be modifying letterpaint-demo. Note the client-side code is from this HTML5 canvas tutorial.

First, download the app, unzip it, and get it running as usual. Note this app is just the default express application with the letterpaint game added to the public/ directory (and minor modifications to the index page).

Do the following:

  • First, play with the game normally and using the developer tools to inspect the page.
  • Then, add a quit button:
    • Add the button to the page in index.html (make it the letter Q) similar to the information and sound buttons.
    • Style the quit button in a fashion similar to the info button in letterpaint.css (look for the #infos attributes). Note you will have to change the offset; otherwise the button will overlap with the info button. (If you do not customize the CSS for the button at all, it will take on the default navbutton properties and overlap with the sound button.)
    • In letterpaint.js:
      • Add a quitbutton variable similar to the one for sound or info.
      • Add an event listener for the quit button, referring to a quit() callback function.
      • Define quit(), having it set the value of window.location to be the URL you wish to visit when you quit ("/").
  • Finally, do one or more of the following tasks:
    • Make the info screen be dismissed when you click anywhere on it (rather than just by clicking on the info button again).
    • Add a counter to the bottom right that tracks the score - how many letters have been traced correctly.
    • Bonus (HARD): Send scores to the server on quit. Save the highest score and have that displayed somewhere in the letterpaint game (say, in the middle of the top bar). The high score should be updated from the server at the start of every game.