-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
176 lines (157 loc) · 4.32 KB
/
index.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pacman</title>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
#game-screen {
box-sizing: border-box;
border: 1px solid black;
}
.game-wrap {
position: relative;
font-family: "Arial","Microsoft YaHei","黑体","宋体",sans-serif;
}
#game-background {
position: absolute;
z-index: -100;
top: 0;
left: 0;
}
.infor-board {
position: absolute;
left: 550px;
top: 0;
margin: 0;
padding: 30px 10px;
width: 130px;
height: 415px;
background-image: url('img/bg-4.jpg');
color: rgb(233,233,216);
}
.infor-board p {
margin: 10px 0;
padding-left: 3px;
line-height: 1.8;
border-radius: 5px;
border: 2px solid orange;
box-shadow: 0px 0px 10px #e2e2e2;
}
.start-interface {
visibility: hidden;
position: absolute;
top: 0;
left: 0;
z-index: 100;
width: 701px;
height: 476px;
background-image: url('img/start.jpg');
}
.end-interface {
visibility: hidden;
position: absolute;
top: 0;
left: 0;
z-index: 100;
width: 701px;
height: 476px;
background-image: url('img/end.jpg');
color: rgb(233,233,216);
font-size: 20px;
padding-top: 60px;
padding-left: 60px;
}
.select-box {
position: absolute;
font-size: 16px;
color: rgb(233,233,216);
top: 100px;
left: 15px;
text-align: center;
}
.select-box p {
line-height: 1.5;
}
.select-box>p:first-child {
cursor: pointer;
}
.select-box>p:nth-child(2) {
cursor: pointer;
}
.select-box>p:nth-child(3) img {
display: inline-block;
vertical-align: -15%;
}
.select-arrow {
visibility: hidden;
}
.select-box>p:first-child:hover .select-arrow {
visibility: visible;
}
.select-box>p:nth-child(2):hover .select-arrow {
visibility: visible;
}
</style>
<script src = "js/scene.js"></script>
<script src = "js/game.js"></script>
<script src = "js/utils.js"></script>
<script src = "js/createmap.js"></script>
<script src = "js/wall.js"></script>
<script src = "js/monster.js"></script>
<script src = "js/bean.js"></script>
<script src = "js/scene-end.js"></script>
<script src = "js/pac-man.js"></script>
<script src = "js/boom.js"></script>
<script src = "js/scene-begin.js"></script>
</head>
<body>
<div class = "game-wrap">
<div class = "start-interface">
<div class = "select-box">
<p class = "begin-button">开始游戏 <img src="img/arrow.png" class="select-arrow" width="16px" alt=""></p>
<p>游戏说明 <img src="img/arrow.png" class="select-arrow" width="16px" alt=""></p>
<p><img src="img/keys.png" width="50px" alt=""> 控制吃豆人移动</p>
<p>鼠标点击或按回车键Start</p>
</div>
</div>
<canvas id = "game-background" width = "700px" height = "475px"></canvas>
<canvas id = "game-screen" width = "699px" height = "474px"></canvas>
<div class = "infor-board">
<p>剩余生命:<span class = "pacMan-hp">0</span></p>
<p>分数:<span class = "score">---</span></p>
<p>关卡: 1</p>
</div>
<div class = "end-interface">
<p class = "win-text">游戏胜利! 请按 r 重新开始游戏</p>
<p class = "lose-text">游戏失败, 请按 r 重新开始游戏</p>
</div>
</div>
<script>
function __main(){
var imagesLib = {
monster: {
'top': ['img/monster-up.png'],
'bottom': ['img/monster-down.png'],
'left': ['img/monster-left.png'],
'right': ['img/monster-right.png']
},
pacMan: {
'top': ['img/pac-up0.png', 'img/pac-up1.png'],
'bottom': ['img/pac-bottom0.png', 'img/pac-bottom1.png'],
'left': ['img/pac-left0.png', 'img/pac-left1.png'],
'right': ['img/pac-right0.png', 'img/pac-right1.png']
},
wall: ['img/brick.png'],
bean: ['img/bean.png']
}
var game = new Game
game.gameStart(imagesLib)
}
__main()
</script>
</body>
</html>