-
Notifications
You must be signed in to change notification settings - Fork 1
/
simple_tetrisk_v0.html
76 lines (71 loc) · 1.5 KB
/
simple_tetrisk_v0.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
<html>
<head>
<title>Learn Javascript!</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script type="text/javascript" src="../lib/iokranf.js"></script>
<style>@font-face { font-family: Square; src: url('media/square.ttf'); }</style>
</head>
<body>
<pre id="iokranf_container" style="height: 680px; font-size:26pt; font-family: Square;"></pre>
<script>
"use strict";
var io=new IOKranf('iokranf_container');
(async function() {
var music=new Audio("media/tetrisk_Music_GameBoy.m4a"); music.loop=true; music.volume=0.3;
var s;
function plot(x,y,t)
{
var p=y*11+x;
s=s.substring(0,p)+t+s.substring(p+1);
}
function initializeS()
{
s="* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"* *\n"+
"**********";
}
function drawTetrisL(x,y)
{
plot(x,y,'#');
plot(x,y+1,'#');
plot(x,y+2,'#');
plot(x+1,y+2,'#');
}
{
io.println("Ready?");
await io.click("Yes!");
io.clr();
music.play();
var y=0;
for(y=0;y<16;y+=1)
{
initializeS();
drawTetrisL(4,y);
await sleep(200);
io.clr(); io.print(s);
}
new Audio("media/tetrisk_land.mp3").play();
music.pause(); music.currentTime=0;
io.close();
}
})();
</script>
</body>
</html>