-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame-native.html
81 lines (72 loc) · 2.96 KB
/
game-native.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
<!DOCTYPE html>
<html>
<head>
<title>GAME</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" />
<script language="javascript" src="js/native/matrix.js"></script>
<script language="javascript" src="js/native/snake.js"></script>
<script language="javascript" src="js/native/game.js"></script>
<script>
window.onload = function() {
var gamePlay = new GamePlay('matrix');
// Начало игры
document.getElementById('start').onclick = function() {
gamePlay.game();
this.setAttribute('disabled', 'disabled');
};
// Когда человек меняет уровень/скорость
document.getElementById('selectSpeed').onchange = function(){
var val = this.querySelectorAll('option:checked')[0].value;
gamePlay.setSpeed(val);
};
// Когда человек отправляет свои данные
document.getElementById('submitName').onclick = function(){
console.log(document.getElementById('playerName'));
gamePlay.saveResults(document.getElementById('playerName').value);
};
};
</script>
</head>
<body>
<div id="matrix">
<!--Форма заполнения результата-->
<div id="nameForm-l" class="nameForm-l hide"></div>
<div id="nameForm" class="nameForm hide">
<h2>Sorry, this is the end!</h2>
<div class="desc">
<input id="playerName" class="playerName" placeholder="Your name (in English)" value="">
</div>
<button class="btn-name" id="submitName">Submit</button>
<div id="nameForm-notice" class="notice"></div>
</div>
<!--/Форма заполнения результата-->
</div>
<!-- Панель управления -->
<div class="control-panel">
<div class="control-panel__left">
<!-- Выбор Уровная сложности -->
<div class="cp">
<h2>Snake</h2>
<select id="selectSpeed" class="selectSpeed">
<option value="1000">1 level</option>
<option value="500">2 level</option>
<option value="50">3 level</option>
</select>
<button class="actionButton start" id="start">Start</button>
</div>
<!-- /Выбор Уровная сложности -->
<!-- Счет -->
<div class="cp">
<h2>Score</h2>
<div id="score" class="score">000</div>
</div>
<!-- /Счет -->
<!-- Результаты -->
<div id="results" class="cp">
</div>
<!-- /Результаты -->
</div>
</div>
<!-- Панель управления -->
</body>
</html>