Skip to content

Commit 7531f64

Browse files
committed
create 1515100169 杜易文的第八次作业
1 parent 68995ea commit 7531f64

File tree

8 files changed

+810
-0
lines changed

8 files changed

+810
-0
lines changed

1515100169/2048/.DS_Store

6 KB
Binary file not shown.

1515100169/2048/css/main.css

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#canvas { display: block; margin: 0 auto; }
2+
header{
3+
display:block;
4+
margin:0 auto;
5+
width:100%;
6+
text-align:center;
7+
}
8+
9+
header h1{
10+
font-family:Arial;
11+
font-size:40px;
12+
font-weight:bold;
13+
margin:0 auto;
14+
}
15+
16+
header #newgamebutton{
17+
display:block;
18+
margin:10px auto;
19+
20+
width:100px;
21+
padding:10px 10px;
22+
background-color:#8f7a66;
23+
24+
font-family:Arial;
25+
color:white;
26+
27+
border-radius:10px;
28+
text-decoration:none;
29+
}
30+
header #newgamebutton:hover{
31+
background-color:#9f8b77;
32+
}
33+
34+
header p{
35+
font-family:Arial;
36+
font-size:25px;
37+
margin:10px auto;
38+
}

1515100169/2048/index.html

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!DOCTYPE html>
2+
<html lang="zh">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no">
6+
<title>HEX</title>
7+
<link href="css/main.css" rel="stylesheet">
8+
<script src="js/controllerLayer.js"></script>
9+
<script src="js/modelLayer.js"></script>
10+
<script src="js/jquery-2.1.4.min.js"></script>
11+
</head>
12+
<body>
13+
<header>
14+
<h1>HEX</h1>
15+
<div id="newgamebutton" onclick="startGame(context)" >开始游戏</div>
16+
<p>score: <span id="score">0</span></p>
17+
</header>
18+
<div id="canvas-warp">
19+
<canvas id="canvas">
20+
你的浏览器居然不支持Canvas?!赶快换一个吧!!
21+
</canvas>
22+
</div>
23+
24+
25+
<script>
26+
27+
var canvas = document.getElementById("canvas");
28+
canvas.width = game_width;
29+
canvas.height = game_width;
30+
var context = canvas.getContext("2d");
31+
32+
// 监听键盘按键,按下时调用moveKeyDown函数
33+
window.addEventListener('keydown', moveKeyDown, true);
34+
35+
36+
window.onload = function(){
37+
38+
// 开始游戏
39+
startGame(context);
40+
41+
// 防止下滑时浏览器滚动
42+
$("body").bind("touchmove",function(event){
43+
event.preventDefault();
44+
});
45+
}
46+
47+
</script>
48+
</body>
49+
</html>

1515100169/2048/js/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)