-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
92 lines (83 loc) · 2.42 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Stay on Edge</title>
<style>
* { padding: 0; margin: 0; border:"1px solid #000000"}
canvas { background: #f6f6f6; display: block; margin: 0 auto; border: "5px solid gray";}
</style>
<link rel="stylesheet" href="style.css">
</head>
<body style ="background-color: #f6f6f6; font-family: sans-serif; font-size: 75%">
<canvas id="gameCanvas" width="540" height="280" ></canvas>
<div class = "block">
<div class="container">
<h1>Hmmm... can't reach this page</h1>
<br>
<br>
<p><strong>www.bing.com</strong>'s server IP address could not be found.</p>
<br>
<br>
<h3>Try:</h3>
<ul>
<li>Checking the connection</li>
<li><a href="">Checking the proxy, firewall, and DNS settings.</a></li>
<li><a href="">Running Windows Network Diagnostics</a></li>
</ul>
<br>
<p class="smallText">ERR_NAME_NOT_RESOLVED</p>
<br>
<br>
<br>
<button class="blueBtn">Refresh</button>
</div>
</div>
<script src="player.js"></script>
<script src="meteor.js"></script>
<script src="star.js"></script>
<script src="space.js"></script>
<script src="platform.js"></script>
<script src="game.js"></script>
<script src="score.js"></script>
<script>
var canvas = document.getElementById("gameCanvas");
var ctx = canvas.getContext("2d");
var game = new Game(ctx);
document.addEventListener('click', onClickHandler, false);
document.addEventListener('keydown', onKeyDownHandler, false);
document.addEventListener('keyup', onKeyUpHandler, false);
function onClickHandler(evt) {
if (game.gameOver) {
var midWidth = canvas.width/2;
var midHeight = canvas.height/2;
var buttonWidth = canvas.width*2/5;
var buttonHeight = canvas.width/8;
if (evt.offsetX > midWidth - buttonWidth/2 && evt.offsetX < midWidth + buttonWidth/2 &&
evt.offsetY > 5 * midHeight / 4 - buttonHeight*2/3 && evt.offsetY <5 * midHeight / 4 + buttonHeight/3) {
restartGame();
}
}
}
function onKeyDownHandler(evt) {
if (game.gameOver) {
if ((game.Player.rightPressed || game.Player.leftPressed) && game.keyUp) {
game.keyUp = false;
}
if (game.keyUp &&
(evt.key == "Right" || evt.key == "ArrowRight" ||
evt.key == "Left" || evt.key == "ArrowLeft" ||
evt.key == " " || evt.key == "Space")) {
restartGame();
}
}
}
function onKeyUpHandler(evt) {
if (game.gameOver) {
game.keyUp = true;
}
}
function restartGame() {
game.restart();
}
</script>