0% found this document useful (0 votes)
32 views2 pages

Pong Atkinson

Uploaded by

api-262560592
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views2 pages

Pong Atkinson

Uploaded by

api-262560592
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

<!

DOCTYPE html>
<html>
<head>
<!-- 2014 Monika Atkinson -->
<meta charset="utf-8">
<SCRIPT LANGUAGE="JavaScript">
var mon = "\r\n";
var x = 1;
var y = 1;
var rxs = 1;
var la = 1;
var s = "";
var u = 0;
var uhoh = false;
var score = 0;

function move1() {
x += rxs;
if (x > 31) {
x -= 2 * Math.abs(rxs);
if (rxs > 0) rxs = -rxs; }
if (x < 0) {
x += 2 * Math.abs(rxs);
if (rxs < 0) rxs = -rxs; }
y += la;
if (y > 14) {
y -= 2 * Math.abs(la);
if (la > 0) la = -la;
if (Math.abs(x - 2*u - 1) > 2) {
uhoh = true;
}
else {
score += 1;
}

}
if (y < 0) { y += 2 * Math.abs(la);
if (la < 0) la = -la; }
}
function display1() {
var s1 = ""
var i,j;
if (uhoh) return "Monika says: try to top up your score, click the button to start again!";
for (j=0;j<15;j++) {

for (i=0;i<32;i++) {
if (j == y && i == x) s1 += "o";
else s1 += ".";
}
s1 += crlf;
}
var s2 = ""
for (i=0;i<16;i++) {
if (u == i) s2 += "==";
else s2 += "..";
}
return (s1+s2)
}
var timerID = null;
var timerRunning = false;
var myform;
function stopclock (){
if(timerRunning) clearTimeout(timerID);
timerRunning = false;
}
function startclock (form) {
myform = form;
uhoh = false;
if (navigator.userAgent.indexOf("Mac") > 2) crlf = "\n";
stopclock();
dotime();
}

function dotime () {
move1();
if (myform != null) {
myform.text3.value = display1();
myform.score.value = " " + score;
}
if (!uhoh) timerID = setTimeout("dotime()",200);
timerRunning = true;

}
</SCRIPT>
</head><body><center><h1><mark>Monika Atkinson's Pong</h1></mark>
<font color = "green"><b>Hover your cursor over the slashes to move your paddle. Press start and play now!</font></
b>
<p><form name=form>
<textarea name=text3 rows=16 cols=34 wrap>[game eld]</textarea>
<p><p>
<a href="" onMouseOver="u =0">\\\</a>
<a href="" onMouseOver="u =1">\\\</a>
<a href="" onMouseOver="u =2">\\\</a>
<a href="" onMouseOver="u =3">\\\</a>
<a href="" onMouseOver="u =4">\\\</a>
<a href="" onMouseOver="u =5">\\\</a>
<a href="" onMouseOver="u =6">\\\</a>
<a href="" onMouseOver="u =7">\\\</a>
<a href="" onMouseOver="u =8">\\\</a>
<a href="" onMouseOver="u =9">\\\</a>
<a href="" onMouseOver="u = 10">\\\</a>
<a href="" onMouseOver="u = 11">\\\</a>
<a href="" onMouseOver="u = 12">\\\</a>
<a href="" onMouseOver="u = 13">\\\</a>
<a href="" onMouseOver="u = 14">\\\</a>
<a href="" onMouseOver="u = 15">\\\</a>
<a href="" onMouseOver="u = 15">\\\</a><p>
<input type=button name=button1 value="Start"
onCLick="startclock(this.form)">

<mark>Score: </mark>
<input type=text name=score size=10 value=0>
</form>
</center>
</body>
</html>

You might also like