-
Notifications
You must be signed in to change notification settings - Fork 1
/
snake.html
185 lines (162 loc) · 3.91 KB
/
snake.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
<HTML>
<HEAD>
<!--Only needed when not using compiled version -->
<script src="closure-library/closure/goog/base.js"></script>
<SCRIPT SRC="snake.js"></SCRIPT>
<script type="text/javascript">var snakeManager = new SnakeManager();</script>
<STYLE>
body {
background: url('images/background_snake_halloween.jpg');
color: white;
}
.gem-piece {
height: 20px;
width: 20px;
display: block;
}
.counter {
height: 20px;
width: 50px;
display: inline;
}
.game-board {
height: 300px;
width: 600px;
position: absolute;
border: 3px solid black;
float: left;
text-align: left;
background: url('images/snakeBackground100.jpg');
}
.snake-piece {
height: 20px;
width: 20px;
position: absolute;
}
.score-message {
font: 14px;
}
.previous-scores {
font: 14px;
font-decoration: bold;
height: 300px;
width: 150px;
float: right;
overflow: scroll;
}
.content1 {
width: 800px;
}
.previous-scores-text {
font-size: 12px;
color: blue;
}
form {
display: inline;
}
.hotkeys {
float: left;
font: 12px;
margin-top: 5px;
}
.finalScore {
float: right;
display: none;
color: red;
text-align: center;
padding-top: 10px;
font-weight: bold;
font-size: 32px;
}
#pauseGameOverlay {
display: none;
position: absolute;
z-index: 100;
top: 0px;
left: 0px;
height: 100%;
width: 100%;
background: url('images/transparentWhite.png');
}
#pauseGameMessage {
color: red;
height: 100%;
width: 100%;
font-weight: bold;
font-size: 48px;
/* Flexbox for centering. */
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-pack: center;
-webkit-box-align: center;
display: -moz-box;
-moz-box-orient: horizontal;
-moz-box-pack: center;
-moz-box-align: center;
display: box;
box-orient: horizontal;
box-pack: center;
box-align: center;
}
#pauseButton {
z-index: 101;
}
#saveButton {
z-index: 101;
}
</STYLE>
</HEAD>
<BODY>
<div align="center">
<DIV ID="pauseGameOverlay">
<DIV ID="pauseGameMessage">Game Paused</DIV>
</DIV>
<H1>Welcome to Snake - Special Version for my Baby Nicole <3</H1>
<P>Use the directional arrows to guide the Snake to the red gems in order to
score points. You will lose if you hit the wall or your body.</P>
<P>You can save game at any time during the game. You can load your previous save
once the game is over.</P>
<FORM ID="snakeSpeedForm" NAME="snakeSpeedForm">
Enter snake speed in moves per second:
<INPUT TYPE="radio" NAME="snakeSpeed" VALUE="5">5</INPUT>
<INPUT TYPE="radio" NAME="snakeSpeed" VALUE="10" CHECKED>10</INPUT>
<INPUT TYPE="radio" NAME="snakeSpeed" VALUE="20">20</INPUT>
<INPUT TYPE="radio" NAME="snakeSpeed" VALUE="30">30</INPUT>
<INPUT TYPE="radio" NAME="snakeSpeed" VALUE="40">40</INPUT>
<INPUT TYPE="radio" NAME="snakeSpeed" VALUE="50">50</INPUT>
<INPUT TYPE="button" ID="restartButton" VALUE="New Game" ONCLICK="snakeManager.startGame()">
<INPUT TYPE="button" ID="loadButton" style="position: relative" VALUE="Load"
ONCLICK="snakeManager.loadGame()">
</FORM>
<INPUT TYPE="button" ID="pauseButton" style="position: relative" VALUE="Pause"
ONCLICK="snakeManager.pauseGame()">
<INPUT TYPE="button" ID="saveButton" style="position: relative" VALUE="Save"
ONCLICK="snakeManager.saveGame()">
<BR>
<DIV STYLE="width: 600px; text-align: left">
<DIV ID="hotkeys" CLASS="hotkeys">
Hotkeys:
<LI>N --------> New Game</LI>
<LI>Space ----> Pause Game</LI>
<LI>S --------> Save Game</LI>
<LI>L ----> Load Game</LI>
</DIV>
<DIV ID="finalScore" CLASS="finalScore">
Game over. Your score is:
<DIV ID="finalScoreNum" STYLE="display: inline">0</DIV>
</DIV>
</DIV>
<DIV style="clear: both">
<H3>Current Score:
<DIV ID="counter" CLASS="counter"></DIV>
</H3>
</DIV>
<DIV ID="content1" class="content1">
<DIV ID="gameBoard" CLASS="game-board"></DIV>
<DIV ID="previousScores" CLASS="previous-scores">
Previous Scores:
</DIV>
</DIV>
</div>
</BODY>
</HTML>