-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
96 lines (83 loc) · 2.22 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
92
93
94
95
96
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Asteroids</title>
</head>
<body>
<script src="assets/jquery-1.11.3.min.js"></script>
<canvas id="game-canvas" style="border: 1px solid black"></canvas>
<script src="lib/keymaster.js"></script>
<script src="lib/util.js"></script>
<script src="lib/movingObject.js"></script>
<script src="lib/asteroid.js"></script>
<script src="lib/ship.js"></script>
<script src="lib/bullet.js"></script>
<script src="lib/game.js"></script>
<script src="lib/gameView.js"></script>
<style type="text/css">
.text {
display: inline-block;
font-size: 70px;
font-family: 'Ocr a std', 'arial';
color: purple;
text-align: center;
}
.button:hover {
color: red;
cursor: pointer;
text-align: center;
}
.panel {
z-index: 1000;
color: white;
font-size: 200%
border: 3px white solid;
display: inline-block;
position: absolute;
height: 600px;
width: 1200px;
/*margin-top: -150px;
margin-left: -300px;
top: 50%;
left: 50%;*/
text-align: center;
-moz-box-sizing: content-box !important;
box-sizing: content-box !important;
padding: 50px;
border-radius: 20px;
background-color: black;
}
</style>
<div class='text panel' id='startScreen'>
ASTEROIDS
<br>
<div class='text name' style='font-size: 30px; color: white;'>
by J.P. McDevitt
<br><br><br>
W, A, S, D to move. Space to shoot.
</div>
<br><br><br>
<div class='text button play'>PLAY GAME!</div>
<br>
<script>
$('#game-canvas').hide();
$('.play').click(function() {
$('#startScreen').hide();
$('#game-canvas').show();
var canvas = document.getElementById("game-canvas");
var ctx = canvas.getContext("2d");
var game = new Asteroids.Game(1200, 600);
canvas.width = game.dimX;
canvas.height = game.dimY;
var img = new Image();
img.onload = function () {
ctx.drawImage(img, 0, 0);
};
img.src = 'assets/space.jpg';
var gameview = new Asteroids.GameView(game, ctx, img);
gameview.start();
});
</script>
</body>
</html>