-
Notifications
You must be signed in to change notification settings - Fork 155
/
index.html
261 lines (225 loc) · 9.14 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<!DOCTYPE html>
<html>
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-121647007-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-121647007-2');
</script>
<meta property="og:image" content="https://pacman-e281c.firebaseapp.com/img/preview.png">
<meta property="og:url" content="https://pacman-e281c.firebaseapp.com/">
<meta property="og:description" content="Pac-Man game written in HTML5 + CSS3 + jQuery with Canvas. This WebApp is a Responsive Web Design (RWD) website.">
<meta property="og:title" content="Lucio PANEPINTO - Pac-Man">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="description" content="Pac-Man game written in HTML5 + CSS3 + jQuery with Canvas. This WebApp is a Responsive Web Design (RWD) website." />
<meta name="keywords" content="pacman, pac-man, pac-man online, pacman online, online, online games, games, free, puzzle, lucio panepinto, lucio, panepinto, html, html5, css, css3, javascript, jquery, rwd, responsive, responsive web design, responsive web, web design, canvas, draw" />
<link rel="stylesheet" type="text/css" href="css/pacman.css" />
<link rel="stylesheet" type="text/css" href="css/pacman-home.css" />
<script type="text/javascript" src="js/jquery.js"></script>
<!--<script type="text/javascript" src="js/jquery-mobile.js"></script>-->
<script type="text/javascript" src="js/jquery-buzz.js"></script>
<script type="text/javascript" src="js/game.js"></script>
<script type="text/javascript" src="js/tools.js"></script>
<script type="text/javascript" src="js/board.js"></script>
<script type="text/javascript" src="js/paths.js"></script>
<script type="text/javascript" src="js/bubbles.js"></script>
<script type="text/javascript" src="js/fruits.js"></script>
<script type="text/javascript" src="js/pacman.js"></script>
<script type="text/javascript" src="js/ghosts.js"></script>
<script type="text/javascript" src="js/home.js"></script>
<script type="text/javascript" src="js/sound.js"></script>
<script type="text/javascript">
function simulateKeyup(code) {
var e = jQuery.Event("keyup");
e.keyCode = code;
jQuery('body').trigger(e);
}
function simulateKeydown(code) {
var e = jQuery.Event("keydown");
e.keyCode = code;
jQuery('body').trigger(e);
}
$(document).ready(function() {
//$.mobile.loading().hide();
loadAllSound();
HELP_TIMER = setInterval('blinkHelp()', HELP_DELAY);
initHome();
$(".sound").click(function(e) {
e.stopPropagation();
var sound = $(this).attr("data-sound");
if ( sound === "on" ) {
$(".sound").attr("data-sound", "off");
$(".sound").find("img").attr("src", "img/sound-off.png");
GROUP_SOUND.mute();
} else {
$(".sound").attr("data-sound", "on");
$(".sound").find("img").attr("src", "img/sound-on.png");
GROUP_SOUND.unmute();
}
});
$(".help-button, #help").click(function(e) {
e.stopPropagation();
if (!PACMAN_DEAD && !LOCK && !GAMEOVER) {
if ( $('#help').css("display") === "none") {
$('#help').fadeIn("slow");
$(".help-button").hide();
if ( $("#panel").css("display") !== "none") {
pauseGame();
}
} else {
$('#help').fadeOut("slow");
$(".help-button").show();
}
}
});
$(".github,.putchu").click(function(e) {
e.stopPropagation();
});
$("#home").on("click touchstart", function(e) {
if ( $('#help').css("display") === "none") {
e.preventDefault();
simulateKeydown(13);
}
});
$("#control-up, #control-up-second, #control-up-big").on("mousedown touchstart", function(e) {
e.preventDefault();
simulateKeydown(38);
simulateKeyup(13);
});
$("#control-down, #control-down-second, #control-down-big").on("mousedown touchstart", function(e) {
e.preventDefault();
simulateKeydown(40);
simulateKeyup(13);
});
$("#control-left, #control-left-big").on("mousedown touchstart", function(e) {
e.preventDefault();
simulateKeydown(37);
simulateKeyup(13);
});
$("#control-right, #control-right-big").on("mousedown touchstart", function(e) {
e.preventDefault();
simulateKeydown(39);
simulateKeyup(13);
});
$("body").keyup(function(e) {
KEYDOWN = false;
});
$("body").keydown(function(e) {
if (HOME) {
initGame(true);
} else {
//if (!KEYDOWN) {
KEYDOWN = true;
if (PACMAN_DEAD && !LOCK) {
erasePacman();
resetPacman();
drawPacman();
eraseGhosts();
resetGhosts();
drawGhosts();
moveGhosts();
blinkSuperBubbles();
} else if (e.keyCode >= 37 && e.keyCode <= 40 && !PAUSE && !PACMAN_DEAD && !LOCK) {
if ( e.keyCode === 39 ) {
movePacman(1);
} else if ( e.keyCode === 40 ) {
movePacman(2);
} else if ( e.keyCode === 37 ) {
movePacman(3);
} else if ( e.keyCode === 38 ) {
movePacman(4);
}
} else if (e.keyCode === 68 && !PAUSE) {
/*if ( $("#canvas-paths").css("display") === "none" ) {
$("#canvas-paths").show();
} else {
$("#canvas-paths").hide();
}*/
} else if (e.keyCode === 80 && !PACMAN_DEAD && !LOCK) {
if (PAUSE) {
resumeGame();
} else {
pauseGame();
}
} else if (GAMEOVER) {
initHome();
}
//}
}
});
});
</script>
<title>Lucio PANEPINTO - Pac-Man</title>
</head>
<body>
<div id="sound"></div>
<div id="help">
<h2>Help</h2>
<table align="center" border="0" cellPadding="2" cellSpacing="0">
<tbody>
<tr><td>Arrow Left : </td><td>Move Left</td></tr>
<tr><td>Arrow Right : </td><td>Move Right</td></tr>
<tr><td>Arrow Down : </td><td>Move Down</td></tr>
<tr><td>Arrow Up : </td><td>Move Up</td></tr>
<tr><td colspan="2"> </td></tr>
<tr><td>P : </td><td>PAUSE</td></tr>
</tbody>
</table>
</div>
<div id="home">
<h1>pac-man</h1>
<h3>Lucio PANEPINTO<br><em>2015</em></h3>
<canvas id="canvas-home-title-pacman"></canvas>
<div id="presentation">
<div id="presentation-titles">character / nickname</div>
<canvas id="canvas-presentation-blinky"></canvas><div id="presentation-character-blinky">- shadow</div><div id="presentation-name-blinky">"blinky"</div>
<canvas id="canvas-presentation-pinky"></canvas><div id="presentation-character-pinky">- speedy</div><div id="presentation-name-pinky">"pinky"</div>
<canvas id="canvas-presentation-inky"></canvas><div id="presentation-character-inky">- bashful</div><div id="presentation-name-inky">"inky"</div>
<canvas id="canvas-presentation-clyde"></canvas><div id="presentation-character-clyde">- pokey</div><div id="presentation-name-clyde">"clyde"</div>
</div>
<canvas id="trailer"></canvas>
<div class="help-button">- help -</div>
<a class="sound" href="javascript:void(0);" data-sound="on"><img src="img/sound-on.png" alt="" border="0"></a>
<a class="github" target="_blank" href="https://github.com/luciopanepinto/pacman"><img src="img/github.png" alt="GitHub - Lucio PANEPINTO - Pac-Man"></a>
<a class="putchu" target="_top" href="http://www.putchu.be"><img src="http://www.putchu.be/img/intro/player.png" height="95px" alt="Putchu">www.putchu.be</a>
</div>
<div id="panel">
<h1>pac-man</h1>
<a class="putchu" target="_top" href="http://www.putchu.be"><img src="http://www.putchu.be/img/intro/player.png" height="65px" alt="Putchu">www.putchu.be</a>
<canvas id="canvas-panel-title-pacman"></canvas>
<div id="score"><h2>1UP</h2><span>00</span></div>
<div id="highscore"><h2>High Score</h2><span>00</span></div>
<div id="board">
<canvas id="canvas-board"></canvas>
<canvas id="canvas-paths"></canvas>
<canvas id="canvas-bubbles"></canvas>
<canvas id="canvas-fruits"></canvas>
<canvas id="canvas-pacman"></canvas>
<canvas id="canvas-ghost-blinky"></canvas>
<canvas id="canvas-ghost-pinky"></canvas>
<canvas id="canvas-ghost-inky"></canvas>
<canvas id="canvas-ghost-clyde"></canvas>
<div id="control-up-big"></div>
<div id="control-down-big"></div>
<div id="control-left-big"></div>
<div id="control-right-big"></div>
</div>
<div id="control">
<div id="control-up"></div>
<div id="control-up-second"></div>
<div id="control-down"></div>
<div id="control-down-second"></div>
<div id="control-left"></div>
<div id="control-right"></div>
</div>
<canvas id="canvas-lifes"></canvas>
<canvas id="canvas-level-fruits"></canvas>
<div id="message"></div>
<div class="help-button">- help -</div>
<a class="sound" href="javascript:void(0);" data-sound="on"><img src="img/sound-on.png" alt="" border="0"></a>
</div>
</body>
</html>