Skip to content

Commit d8e88a8

Browse files
create 1520600056 林健珍 的第12周作业
1 parent 68995ea commit d8e88a8

File tree

7 files changed

+864
-0
lines changed

7 files changed

+864
-0
lines changed

1520600056/css/main.css

+38
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+
}

1520600056/index.html

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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>2048</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>2048</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+
<script>
24+
var canvas = document.getElementById("canvas");
25+
canvas.width = game_width;
26+
canvas.height = game_width;
27+
var context = canvas.getContext("2d");
28+
29+
// 监听键盘按键,按下时调用moveKeyDown函数
30+
window.addEventListener('keydown', moveKeyDown, true);
31+
32+
window.onload = function(){
33+
// 开始游戏
34+
startGame(context);
35+
// 防止下滑时浏览器滚动
36+
$("body").bind("touchmove",function(event){
37+
event.preventDefault();
38+
});
39+
}
40+
</script>
41+
</body>
42+
</html>

1520600056/js/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)