Skip to content

Commit c8f0817

Browse files
Candy2512Candy2512
authored andcommitted
create 1515200001吴一涵的第八次作业
1 parent 68995ea commit c8f0817

File tree

7 files changed

+827
-0
lines changed

7 files changed

+827
-0
lines changed

.project

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>2048</name>
4+
<comment>Create By HBuilder</comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>com.aptana.ide.core.unifiedBuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
</buildSpec>
14+
<natures>
15+
<nature>com.aptana.projects.webnature</nature>
16+
</natures>
17+
<filteredResources>
18+
<filter>
19+
<id>1481357335002</id>
20+
<name></name>
21+
<type>10</type>
22+
<matcher>
23+
<id>org.eclipse.ui.ide.orFilterMatcher</id>
24+
<arguments>
25+
<matcher>
26+
<id>org.eclipse.ui.ide.multiFilter</id>
27+
<arguments>1.0-projectRelativePath-matches-false-false-bin</arguments>
28+
</matcher>
29+
<matcher>
30+
<id>org.eclipse.ui.ide.multiFilter</id>
31+
<arguments>1.0-projectRelativePath-matches-false-false-setting</arguments>
32+
</matcher>
33+
</arguments>
34+
</matcher>
35+
</filter>
36+
</filteredResources>
37+
</projectDescription>

2048.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
修改:
2+
1.游戏开始改为4或8
3+
2.记分机制改为合并后加上的分值就是原本的分值

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

index.html

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

0 commit comments

Comments
 (0)