forked from satls/PacMan
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPacMan.html
More file actions
102 lines (95 loc) · 2.71 KB
/
Copy pathPacMan.html
File metadata and controls
102 lines (95 loc) · 2.71 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PacMan</title>
<script type="text/javascript" src="jquery-2.0.0.js"></script>
<script type="text/javascript" src="Ghost.js"></script>
<script type="text/javascript" src='Game.js'></script>
<script type="text/javascript" src='PacMan.js'></script>
<script type="text/javascript" src='Cell.js'></script>
<script>
var canvas;
var board;
$(document).ready(function(){
canvas = document.getElementById('pacmanGame');
board = new Game(28,31, canvas);
document.onkeydown = function(e){
if (e.keyCode == 87 || e.keyCode==38) {
board.inPut('w');
}
if (e.keyCode == 65 || e.keyCode==37) {
board.inPut('a');
}
if (e.keyCode == 68 || e.keyCode==39) {
board.inPut('d');
}
if (e.keyCode == 83 || e.keyCode==40) {
board.inPut('s');
}
}
board.addPacMan(14,23);
board.addGhost(12,14);
board.draw();
board.start();
});
function addBlinky(){
board.getBlinky().setPos(14,11);
}
function addPinky(){
board.getPinky().setPos(14,11);
}
function addInky(){
board.getInky().setPos(14,11);
}
function addClyde(){
board.getClyde().setPos(14,11);
//board.getClyde().setPos(10,29);
}
function scatter(){
board.scatterGhosts();
}
function chase(){
board.chaseGhosts();
}
function frighten(){
board.frightenGhosts();
}
function unfrighten(){
board.unfrightenGhosts();
}
function pause(){
board.pause();
}
function start(){
board.start();
}
</script>
</head>
<body>
<div id="PacManFixture"/>
<canvas id="pacmanGame" width='560px' height='620px'></canvas>
<!-- <canvas id="pacmanGame" width='840px' height='930px'></canvas> -->
</div>
<div id='gameControls'>
<input type=submit value='blinky' onclick='addBlinky()'></input>
<input type=submit value='pinky' onclick='addPinky()'></input>
<input type=submit value='inky' onclick='addInky()'></input>
<input type=submit value='clyde' onclick='addClyde()'></input>
<input type=submit value='scatter' onclick='scatter()'></input>
<input type=submit value='chase' onclick='chase()'></input>
<input type=submit value='frighten' onclick='frighten()'></input>
<input type=submit value='unfrighten' onclick='unfrighten()'></input>
<input type=submit value='pause' onclick='pause()'></input>
<input type=submit value='start' onclick='start()'></input>
</div>
<div id='nibbles'></div>
<div id='lifes'></div>
<div id='pinky timer'></div>
<div id='inky timer'></div>
<div id='clyde timer'></div>
<div id='chase timer'></div>
<div id='scatter timer'></div>
<div id='frightened timer'></div>
</body>
</html>