HTML and CSS Reference
In-Depth Information
Code
Explanation
<canvas id="canvas" width="600" height=
"400">
Starting canvas tag
Your browser doesn't support the HTML5
element canvas.
Message for noncompliant browsers
</canvas>
Closing tag
<br/>
Line break
<form name="f">
Starting tag for form, giving form a name
Score: <input name="score" value="0"
size="3"/>
Label and then input field, with initial value
and size
</form>
Closing tag for form
</body>
Closing tag for body
</html>
Closing tag for html document
The audio enhanced version required three more global variables along with additions in the init , choose
and flyin functions. The new global variables are
var music = [
[3,1,0],
[1,3,2],
[0,2,3]];
var musicelements;
var musicch;
Here is the clause in the choose function with the new line highlighted.
if ((mx>ch.sx)&&(mx<ch.sx+ch.bwidth)&&(my>ch.sy)&&(my<ch.sy+ch.bheight)) {
drawall();
size = 15;
tid = setInterval(flyin,100);
result = beats[compch][i];
musicch = music[compch][i];
newscore = Number(document.f.score.value);
newscore +=points[compch][i];
break;
}
Similarly, heres the complete flyin function with the new line in bold:
 
Search WWH ::




Custom Search