-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
86 lines (83 loc) · 2.4 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
<!DOCTYPE html>
<html>
<head>
<style>
h1,h2{
color:white;
}
h1{
font-size: 40px;
}
img.game{
height:150px;
width:250px;
}
span.red{
color:red;
}
span.green{
color:green;
}
body{
background-image:url("images/background.jpg");
background-size:cover;
background-repeat:no-repeat;
}
p{
color:white;
}
canvas{
top:0;
left:0;
width:99%;
height:99%;
position:absolute;
pointer-events:none;
}
</style>
<meta charset="UTF-8">
<title>Henry's Games</title>
</head>
<body>
<div id='musicDiv' style='position:absolute; height:100px;width;30%;top:100%'><iframe id='musicIframe' height='100px' scrolling='no' frameborder='no' src='https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/298578920&auto_play=true&hide_related=true&show_comments=false&show_user=false&show_reposts=false&visual=true'></iframe></div>
<script>
window.addEventListener('load',function(){
var snow = [];
var GAME_WIDTH=640;
var GAME_HEIGHT=360;
var canvas=document.getElementById("myCanvas");
var ctx=canvas.getContext("2d");
ctx.fillStyle="white";
function step(){
ctx.clearRect(0,0,GAME_WIDTH,GAME_HEIGHT);
//do snow stuff
var snowBoolean=Math.floor(Math.random()*10)+1;
if(snowBoolean==1){
var snowCoord=Math.floor(Math.random()*21)+1;
snow.push({x:snowCoord*30,y:-5});
}
for(var i in snow){
snow[i].y += 1;
snow[i].x -= 0.2;
if(snow[i].y > GAME_HEIGHT) {
snow.splice(i,1);
}
}
for(var i in snow){
ctx.fillRect(snow[i].x,snow[i].y,3,10);
}
window.requestAnimationFrame(step);
}
step();
});
</script>
<canvas id="myCanvas" width="640" height="360"></canvas>
<h1>Henry's Games</h1>
<h1><span class="red">CHRISTMAS</span> <span class="green">EDITION</span></h1>
<h2>If you have a touch screen, scroll down to play music</h2>
<a href="snake/index.html"><img class="game" src="../images/snake.png"/></a>
<a href="shooter/index.html"><img class="game" src="../images/shoot.png"/></a>
<a href="frogger/index.html"><img class="game" src="../images/frogger.png"/></a>
<a href="sleigh/index.html"><img class="game" src="../images/sleighRide.png"/></a>
</body>
</html>