HTML and CSS Reference
In-Depth Information
Code
Explanation
ctx.drawImage(compimg,
70,
Draw the computer-move image on the screen
at the indicated place and with dimensions
indicated
100,size,size);
size +=5;
Change the value of the dimensions by
incrementing size
if (size>50) {
Use the size variable to see if the process
has gone on long enough
clearInterval(tid);
Stop the timing event
ctx.fillText(result,
200,100,250);
Display the message
document.f.score.value
= String(newscore);
Display the new score. See the section below
the table for the addition for audio
}
Close of if true clause
}
Close of function
var rockb = new Throw(rockbx,rockby,8,50,
50,"rgb(250,0,0)","rock.jpg");
Create the rock object
var
paperb
=
new
Create the paper object
Throw(paperbx,paperby,8,50,
50,"rgb(0,200,200)","paper.gif");
var scib = new Throw(scissorsbx,scissorsby,
8,50,50,"rgb(0,0,200)","scissors.jpg");
Create the scissors object
everything.push(rockb);
Add the rock object to the everything array
everything.push(paperb);
Add the paper object to the everything array
everything.push(scib);
Add the scissors object to the everything
array
function init(){
Header for function called on load of the
document
document.f.score.value = "0";
Set score to zero. I also could use
Search WWH ::




Custom Search