forked from unphased/tetris
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.html
More file actions
216 lines (179 loc) · 7.57 KB
/
game.html
File metadata and controls
216 lines (179 loc) · 7.57 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
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -->
<head>
<meta http-equiv="Content-Type" content="text/html" charset="utf-8"/>
<meta name="keywords" content="steven lu, tetris, game, free, javascript, html5, browser, native, iOS, iPhone, iPad, iPad 2, Android, webkit, opera, chrome, touch, safari" />
<meta name="description" content="This is a HTML5 tetris game that has wide browser support. It provides innovative intuitive touch controls for Apple iOS iPhone iPad products and also Android devices. " />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<title>Tetris!</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js"></script>
<script src="strokeText.js"></script>
<!-- <link rel="stylesheet" href="page.css" type="text/css" /> -->
<style type="text/css"> /* These are just for finger debug elements */
button {font-size: 120%; margin: 0; vertical-align: baseline; *vertical-align: middle;}
.finger-indicator {
position: absolute;
z-index: 4;
border: 2px solid #4a4;
background-color: rgba(0,50,0,0.5);
padding: 4px;
}
.finger-indicator.control {
background-color: rgba(50,0,0,0.5);
border: 2px solid #a44;
}
table {
border-collapse: collapse;
}
td {
padding: 5px;
border: 1px solid gray;
}
.ui-dialog {
padding-top: 20px;
padding-left: 40px;
padding-right: 40px;
padding-bottom: 40px;
position: absolute;
background: #DCDCDC;
border: 1px solid #808080;
-webkit-box-shadow: 0 0px 5px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0 0px 5px rgba(0, 0, 0, 0.5);
box-shadow: 0 0px 5px rgba(0, 0, 0, 0.5);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 2px;
}
.ui-dialog-content {
font-family: sans-serif;
font-size: 20px;
}
.ui-dialog-titlebar-close {
display: none;
}
.ui-dialog-buttonpane {
margin-top: 15px;
margin-left: 200px;
}
#take_survey {
color: #FFF;
background-color: #0f5895;
background-repeat: repeat-x;
background-image: -khtml-gradient(linear, left top, left bottom, from(#377bb2), to(#0f5895));
background-image: -moz-linear-gradient(top, #377bb2, #0f5895);
background-image: -ms-linear-gradient(top, #377bb2, #0f5895);
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #377bb2), color-stop(100%, #0f5895));
background-image: -webkit-linear-gradient(top, #377bb2, #0f5895);
background-image: -o-linear-gradient(top, #377bb2, #0f5895);
background-image: linear-gradient(top, #377bb2, #0f5895);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#377bb2', endColorstr='#0f5895', GradientType=0);
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
color: #ffffff;
text-shadow: none;
margin: 5px 10px 5px 0;
}
.pulse {
font-size:40px;
color: red;
}
.time-up {
font-size:0px;
color:red;
}
</style>
</head>
<body>
<!-- <div id='indicatorcontainer'></div> -->
<canvas id="board_canvas" width="120" height="250" style="position:fixed; left:10px; top:10px; z-index:1">
Your browser does not support HTML5 Canvas.
</canvas>
<canvas id="animated_canvas" width="120" height="250" style="position:fixed; left:10px; top:10px; z-index:3"></canvas>
<canvas id="shadow_canvas" width="120" height="250" style="position:fixed; left:10px; top:10px; z-index:2"></canvas>
<canvas id="next_canvas" width="120" height="250" style="position:fixed; left:10px; top:10px; z-index:2"></canvas>
<!-- <div id="placeholder" style=""> </div> -->
<div style="position: fixed; top: 10px; font-family:Sans-serif; font-size:25px">Lines cleared: <span id="score" >0</span></div>
<div style = "text-align: center; position: fixed; font-family: sans-serif; font-size: 25px">Game ends in<br><span style = "font-size:30px;" id = "timer"></span></div>
<table id="controls">
<tr>
<th>Control</th>
<th>Action</th>
</tr>
<tr>
<td>Left/right arrows</td>
<td>Move piece left/right</td>
</tr>
<tr>
<td>Up arrow, X</td>
<td>Rotate piece clockwise</td>
</tr>
<tr>
<td>Z</td>
<td>Rotate piece counterclockwise</td>
</tr>
<tr>
<td>Down arrow</td>
<td>Accelerate piece downwards</td>
</tr>
<tr>
<td>Space</td>
<td>Immediately drop piece</td>
</tr>
</table>
<script src='tetris.js' type="text/javascript"></script>
<script type='text/javascript'>
countdown(5);
TETRIS.setScoreIncreasing();
</script>
<!-- <div id="instructions" style='position: relative'>
<div id='controls' style='float: left' >
<input type='button' onclick="if (TETRIS.isPaused()) { TETRIS.unPause(); } else { TETRIS.setPause(); }" value='Pause' style='font-size: 150%' /><br/>
<p><input type='button' onclick='var i = document.getElementById("instr").style; i.display = (i.display=="none"?"inline":"none"); TETRIS.setPause(); ' value='Toggle Instructions' /></p>
</div>
<div id='instr' style='display: none;'>
<h1>HTML5 Tetris</h1>
<p> Touch events are now supported! Play on iOS and Android: <br/>
Swipe anywhere to move, tap to rotate (Can also tap while swiping to rotate). Swipe down to drop.
</p>
<p>
Touch Sensitivity:
<input id = 'sens_range' type='range' min='0.2' max='5' step='0.05' value='1' onchange='TETRIS.setTouchSensitivity(this.value); document.getElementById("sensitivity").innerHTML = Math.round(this.value*1000)/1000;'/>
<span id='sensitivity'>1</span>
</p>
<p> For PC/Mac: Use the Arrow keys to move and rotate, spacebar to drop.
Z,X to rotate in either direction. </p>
<p> Pause: P</p>
<p> Mouse control (toggle): M</br>
left click to rotate and right click to drop. Mouse control is experimental.
</p>
<p> To start a new game, refresh the page (F5)! </p>
<p>This is an infinite tetris game. It does not speed up.
To score more points, drop pieces as fast
as you can!</p>
<p>Changes coming soon (To do list): </p>
<ul>
<li>Centered positioning of board</li>
<li>Preview next piece(s)</li>
<li>More visual effects and animations: CSS3 transitions for animation, with fallback to JS animation. In particular I want a satisfying effect for the hard drop.</li>
</ul>
<p><input type='button' onclick='var result = TETRIS.toggle_touch_draw(); if (result) {this.value = "Turn Touch Debug Off"; } else { this.value="Turn Touch Debug On";}' value='Toggle touch debug' /></p>
</div>
</div> -->
</body>
</html>