-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
203 lines (198 loc) · 7.12 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
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<title>Sokoban</title>
<style>
@font-face {
font-family: 'press_start_2pregular';
src: url('font/pressstart2p-webfont.eot');
src: url('font/pressstart2p-webfont.eot?#iefix') format('embedded-opentype'),
url('font/pressstart2p-webfont.woff2') format('woff2'),
url('font/pressstart2p-webfont.woff') format('woff'),
url('font/pressstart2p-webfont.ttf') format('truetype'),
url('font/pressstart2p-webfont.svg#press_start_2pregular') format('svg');
font-weight: normal;
font-style: normal;
}
html {
font-size: 24px;
}
@media (max-width: 900px) {
html { font-size: 17px; }
}
@media (max-width: 400px) {
html { font-size: 15px; }
}
body {
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
canvas {
position: absolute;
top: 0;
left: 0;
}
img {
display: block;
max-width: 100%;
height: auto;
margin: 0 auto;
padding-bottom: 40px;
}
#ui {
position: absolute;
width: 100%;
height: 100%;
}
#main_menu {
font-family: 'press_start_2pregular';
color: #fff;
}
.main-menu-button {
text-transform: uppercase;
cursor: pointer;
display: block;
font-family: 'press_start_2pregular';
font-size: 100%;
background-color: #333;
border: none;
margin: 0 auto;
padding: 1em;
color: #fff;
}
.main-menu-button:hover, .main-menu-button:focus {
color: #ddd;
outline: 0;
}
.main-menu-button:hover:before, .main-menu-button:focus:before {
position: absolute;
margin-left: -1.5em;
content: ">";
}
.menu-button {
text-transform: uppercase;
cursor: pointer;
display: block;
font-family: 'press_start_2pregular';
font-size: 100%;
background-color: #27ae60;
border: none;
margin: .5em auto 0 auto;
padding: 1em;
color: #fff;
}
.menu-button:hover {
background-color: #1f8c4d;
}
#ingame-menu, #winning-menu, .modal {
margin: 0 auto;
z-index: 9999;
position: absolute;
font-family: 'press_start_2pregular';
color: #fff;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.2);
display: none;
}
p.textblock {
text-align: center;
padding: 3%;
line-height: 2em;
margin: 0 auto;
}
.centered {
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.modal {
background-color: #1abc9c;
}
.crates {
color: #c0392b;
}
.marked {
color: #f1c40f;
}
#status-bar {
color: #fff;
font-family: 'press_start_2pregular';
}
#userbar-canvas {
left: 10%;
}
#restart {
font-size: 50%;
margin-top: 6em;
margin-left: 10%;
display: none;
}
h2 {
margin-bottom: 0;
}
.text-center {
text-align: center;
}
.black {
color: #000;
}
</style>
</head>
<body>
<script src="js/rAF.js"></script>
<script src="js/game.js"></script>
<script src="js/UI.js"></script>
<script src="js/Player.js"></script>
<script src="js/Crate.js"></script>
<script src="js/Board.js"></script>
<audio id="swipe" src="audio/swipe.wav"></audio>
<audio id="good" src="audio/good.wav"></audio>
<div id="ui">
<button class="menu-button" id="restart" onclick="Game.restartLevel()">Restart level</button>
<canvas id="userbar-canvas"></canvas>
<div id="help" class="modal">
<div class="centered">
<h2 class="text-center black">HOW TO PLAY</h2>
<p class="textblock">Push all the <span class="crates">crates</span> on <span class="marked">marked fields</span>.</p>
<h2 class="text-center black">CONTROLS</h2>
<p class="textblock">In order to control the player use <span class="black"> arrow keys</span> or if you play on a device with touch screen <span class="black">tap</span> the tile you want to go.</p>
<button class="menu-button" onclick="hideUi('help')">Close</button>
</div>
</div>
<div id="info" class="modal">
<div class="centered">
<p class="textblock">Created by Adrian N.</p>
<button class="menu-button" onclick="hideUi('info')">Close</button>
</div>
</div>
<div id="winning-menu">
<div class="centered">
<p class="textblock">Game completed!</p>
<button class="menu-button" onclick="hideUi('winning-menu'); Game.clearGame()">Hurray!</button>
</div>
</div>
<div id="ingame-menu">
<div class="centered">
<p class="textblock">Level completed!</p>
<button class="menu-button" onclick="Game.switchLevel(); hideUi('ingame-menu'); showUi('restart');">Next level</button>
<button class="menu-button" onclick="Game.restartLevel(); hideUi('ingame-menu'); showUi('restart');">Play again</button>
</div>
</div>
<div class="centered">
<div id="main-menu">
<img src="logo.png" alt="Sokoban logo">
<button class="main-menu-button" onclick="Game.start()">Start game</button>
<button class="main-menu-button" onclick="showUi('help')">Help</button>
<button class="main-menu-button" onclick="showUi('info')">Info</button>
</div>
</div>
</div>
</body>
</html>