-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
170 lines (160 loc) · 6.93 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8" />
<!-- import of webgl utilities -->
<script src="./js/gl-matrix.js"></script>
<script src="./js/webglTools.js"></script>
<script src="./js/corsRequest.js"></script>
<script src="./js/iscroll.js"></script>
<script src="./js/stats.js"></script>
<!-- google fonts -->
<link href="https://fonts.googleapis.com/css?family=Press+Start+2P|Raleway" rel="stylesheet">
<link rel="stylesheet" href="styles.css">
<title>Snake3D</title>
<!-- vertex shader -->
<script id="shader-vs" type="x-shader/x-vertex">
attribute vec3 aVertexPosition;
attribute vec4 aColor;
uniform mat4 uMVMatrix;
uniform mat4 uPMatrix;
varying vec4 vColor;
uniform float uSize;
uniform float uShadow;
void main(void) {
float a= (aVertexPosition.z / uSize) * uShadow + (1.0 - uShadow);
vColor = aColor * (vec4(a,a,a,1.0));
gl_PointSize=12.0;
gl_PointSize=(aVertexPosition.z+8.0)*1.0;
gl_Position = uPMatrix * uMVMatrix * vec4(aVertexPosition, 1.0);
}
</script>
<!-- fragment shader -->
<script id="shader-fs" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
#endif
varying vec4 vColor;
void main(void) {
gl_FragColor = vColor;
}
</script>
</head>
<!-- initialize webgl onload -->
<body onload="initCanvas()">
<div id="container">
<main>
<h1>Snake3D</h1>
<div id="canvas-container">
<p id="bonus"></p>
<!-- webgl canvas -->
<canvas id="webgl-canvas">
HTML5 is not supported
</canvas>
<div id="game-menu">
<div class="game-menu-content" id="start-menu">
Cliquez ici ou appuyez sur Espace pour démarrer
</div>
<div class="game-menu-content" id="pause-menu">
<h2>Pause</h2>
<p>Appuyez sur Espace pour reprendre le jeu</p>
</div>
<div class="game-menu-content" id="gameover-menu">
<div id="gameover-flexbox">
<h2>Game Over</h2>
<p>Votre score : <span id="gameover-score">0</span></p>
<form id="score-form">
<input type="text" placeholder="Votre nom" id="nom" maxlength="16">
<button class="btn" id="envoyer">Envoyer</button>
</form>
<h3>Meilleures scores</h3>
<div id="scores"></div>
<button class="btn" id="recommencer" onclick="restart()">Recommencer</button>
</div>
</div>
</div>
</div>
</main>
<aside>
<p id="infos">
Score: <span id="score">0</span>
|
Level: <span id="level">1</span>
|
<span id="objectif"></span>
|
Temps: <span id="temps">60</span>
</p>
<p>
<a onclick="toggleHelp()">aide</a>
<span style="float: right" id="audioControls">
<a onclick="toggleMute(this)">son</a> |
<a onclick="toggleMusic(this)">musique</a>
</span>
</p>
<div id="help">
<p><b>Contrôles</b></p>
<p>Vous avez deux possibilités pour contrôler le serpent, au clavier ou à la souris (ou au doigt,
sur appareils tactiles).</p>
<p>Au clavier :</p>
<ul>
<li>
Déplacements verticaux : Flèches <span style="color: cyan">haut</span> et <span
style="color:red">bas</span>
</li>
<li>
Déplacements horizontaux : Flèches <span style="color: yellow">gauche</span> et <span
style="color: violet">droite</span> OU touches <span style="color: yellow">A</span> et
<span style="color: violet">D</span>
</li>
<li>
Déplacements dans la profondeur : Touches <span style="color:#0b0">W</span> et <span
style="color: #55f">S</span>
</li>
<li>
Pause : Barre d'espace
</li>
</ul>
<p>À la souris ou au doigt :</p>
<ul>
<li>
Déplacement horizontaux et verticaux : Cliquez simplement sur l'un des quatres murs <span
style="color: cyan">plafond</span>, <span
style="color:yellow">gauche</span>, <span
style="color:red">sol</span> ou <span
style="color:violet">droite</span>.
</li>
<li>
Déplacements dans la profondeur : Scrollez ou faites glisser votre doigt vers le haut pour
aller <span style="color: #0b0">en arrière</span> et vers le bas pour venir <span
style="color: #55f">en avant</span>.
</li>
<li>
Pause : Cliquez au centre du cube.
</li>
</ul>
<p><b>À propos</b></p>
<p>
Mini-projet réalisée au sein de la Haute-École Arc - Ingénierie, section développement
logiciel et multimédias, dans le cadre du cours infographie de 3ème année de Bachelor
</p>
<p>
Joaquim Perez<br>
25.01.2017
</p>
</div>
</aside>
</div>
<!-- sons -->
<audio id="bonusSound" src="audio/bonus.wav"></audio>
<audio id="gameOverSound" src="audio/gameover.wav"></audio>
<audio id="levelUpSound" src="audio/levelup.wav"></audio>
<audio id="moveSound" src="audio/move.wav"></audio>
<audio id="music" src="audio/music.mp3" loop></audio>
<!-- import application scripts -->
<script src="drawables.js"></script>
<script src="snake.js"></script>
<script src="scene.js"></script>
<script src="ui.js"></script>
</body>
</html>