-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
62 lines (52 loc) · 1.96 KB
/
index.html
File metadata and controls
62 lines (52 loc) · 1.96 KB
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>方块冒险</title>
<link rel="stylesheet" href="./css/style.css">
</head>
<body>
<div class="kbBox" id="kbBox"></div>
<div class="startGame" id="startGame">
<div class="blockTitle">
<p>方块冒险</p>
</div>
<a href="javascript:void(0)" id="enterGame">开始游戏</a>
</div>
<div class="gameId" id="gameId" style="display: none;">
<p>游戏玩法:使用左键、右键和上箭头键移动。</p>
<div class="canvasDiv">
<div class="talk" id="talk"><span id="talkMsg">你好啊</span></div>
<canvas id="canvas"> </canvas>
</div>
</div>
<script src="./js/mapData.js"></script>
<script src="./js/map.js"></script>
<script src="./js/game.js"></script>
<script src="./js/npc.js"></script>
<script src="./js/local.js"></script>
<script>
window.onload = function () {
if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
alert('请用电脑端打开!');
location.href = 'http://blog.xiaoiyao.cn';
return false;
} else {
var height = document.documentElement.clientHeight;
var kbBox = document.getElementById("kbBox");
var top = height - 400;
console.log(top);
kbBox.setAttribute("style", "height:" + top / 2 + "px");
var startGameId = document.getElementById("startGame");
var enterGameId = document.getElementById("enterGame");
var gameId = document.getElementById("gameId");
enterGameId.onclick = function () {
gameId.setAttribute("style", "display:block");
startGameId.setAttribute("style", "display:none");
Loop();
}
}
}
</script>
</body>
</html>