-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
103 lines (86 loc) · 2.89 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
97
98
99
100
101
102
103
<!doctype HTML>
<html>
<head>
<title>LD40</title>
<link href="./fonts.css" rel="stylesheet" type="text/css"/>
<link href="./main.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="main-container">
<h1 id="loading">LOADING...</h1>
<h1>Ludum Dare 40 - DANGER NOODLE</h1>
<h2>By Matt Roelle</h2>
<p>
<a target="_blank" href="mailto:[email protected]">[email protected]</a>
<a target="_blank" href="https://github.com/Mattykins/ld40">Source Code</a>
</p>
<button id="mute-btn">Mute</button>
<p class="warning">
This game was built using some features of ES6 and webGL, as a result this game requires a new-ish version of Chrome or FireFox. Interenet Explorer will not work.
</p>
</div>
<!-- Audio -->
<audio id="audio-world1" loop="true"> <source src="./assets/music/world1.wav" type="audio/wav" /> </audio>
<audio id="audio-eat"> <source src="./assets/music/eat.wav" type="audio/wav" /> </audio>
<audio id="audio-warping"> <source src="./assets/music/warping.wav" type="audio/wav" /> </audio>
<audio id="audio-die"> <source src="./assets/music/die.wav" type="audio/wav" /> </audio>
<audio id="audio-dash"> <source src="./assets/music/dash.wav" type="audio/wav" /> </audio>
<!-- Shaders -->
<script type="glsl" id="snake-shader">
precision lowp float;
uniform vec4 uOverlayColor;
uniform bool uOverlay;
// Default PIXIjs vars
uniform sampler2D uSampler;
varying vec4 vColor;
varying vec2 vTextureCoord;
void main(){
vec4 c = texture2D(uSampler, vTextureCoord);
if (uOverlay == true && c.a > 0.0) {
gl_FragColor = uOverlayColor;
} else {
gl_FragColor = c;
}
}
</script>
<script type="glsl" id="intro-shader">
precision lowp float;
uniform float uTime;
uniform vec2 uResolution;
// Default PIXIjs vars
uniform sampler2D uSampler;
varying vec4 vColor;
varying vec2 vTextureCoord;
const float PI = 3.14159265359;
void main() {
float t = uTime;
float nt = t/0.8;
//float nt = 0.25;
//vec2 npos = gl_FragCoord.xy/uResolution.xy;
//float theta = atan(npos.y - 0.5, npos.x - 0.5) + PI;
//float thresh = nt * 2.0 * PI + (nt*2.0);
float dy = abs(gl_FragCoord.y - (uResolution.y/2.0) - 45.0);
float thresh = nt*uResolution.y/2.0;
if (dy < thresh) {
gl_FragColor = texture2D(uSampler, vTextureCoord);
} else {
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
}
}
</script>
<!-- Dependencies -->
<script src="./vendor/pixi.js"></script>
<!-- App -->
<script src="./src/init.js"></script>
<script src="./src/constants.js"></script>
<script src="./src/utils.js"></script>
<script src="./src/audio.js"></script>
<script src="./src/input.js"></script>
<script src="./src/graphics.js"></script>
<script src="./src/enemies.js"></script>
<script src="./src/level.js"></script>
<script src="./src/snake.js"></script>
<script src="./src/game.js"></script>
<script src="./src/main.js"></script>
</body>
</html>