-
Notifications
You must be signed in to change notification settings - Fork 0
/
wumpus.html
80 lines (80 loc) · 3.39 KB
/
wumpus.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
<!DOCTYPE html>
<html>
<head>
<title>Wumpus</title>
<script type="text/javascript" src="2d.js"></script>
<script type="text/javascript" src="sprites.js"></script>
<script type="text/javascript" src="keyboard.js"></script>
<script type="text/javascript" src="main-loop.js"></script>
<script type="text/javascript" src="sound.js"></script>
<script type="text/javascript" src="wumpus-desenho.js"></script>
<script type="text/javascript" src="wumpus-modelo.js"></script>
<script type="text/javascript" src="wumpus-controlador.js"></script>
<script type="text/javascript">
async function loading() {
const $ = x => document.querySelector(x);
const finder = (name, ext) => `./musicas/${ext}/${name}.${ext}`;
const sprites = await SpriteSheet.create(4, 10, "Wumpus5.png");
const larg = new IntVar("Largura", 10, $("#larg"), $("#larg-up"), $("#larg-dn"));
const alt = new IntVar("Altura", 10, $("#alt"), $("#alt-up"), $("#alt-dn"));
const bur = new IntVar("Buracos", 10, $("#bur"), $("#bur-up"), $("#bur-dn"));
const som = new BoolVar("Ligar som", "Desligar som", true, $("#som"));
const musica = new BoolVar("Ligar música", "Desligar música", true, $("#musica"));
const repertorio = new Playlist(nomesSons, nomesMusicas, finder, finder);
const cfg = new Config(document, $("#subtitulo"), $("#restart"), larg, alt, bur, som, musica, repertorio);
new MapaController($("#jogo"), cfg, sprites, repertorio);
}
loading();
</script>
<style type="text/css">
h2 {
overflow: hidden;
white-space: nowrap;
}
button {
font-weight: bold;
border: 1px double white;
outline: 1px solid #2020FF;
background: #2020FF;
margin: 2px;
color: white;
display: inline-block;
}
.info {
width: 314px;
display: inline-block;
text-align: center;
}
.menos, .mais {
width: 25px;
}
.ultima button {
width: 120px;
}
</style>
</head>
<body>
<h2 id="subtitulo"></h2>
<canvas id="jogo"></canvas>
<div class="linha">
<button id="larg-dn" class="menos larg">-</button>
<span id="larg" class="info"></span>
<button id="larg-up" class="mais larg">+</button>
</div>
<div class="linha">
<button id="alt-dn" class="menos alt">-</button>
<span id="alt" class="info"></span>
<button id="alt-up" class="mais alt">+</button>
</div>
<div class="linha">
<button id="bur-dn" class="menos bur">-</button>
<span id="bur" class="info"></span>
<button id="bur-up" class="mais bur">+</button>
</div>
<div class="linha ultima">
<button id="restart">Recomeçar</button>
<button id="som">Som</button>
<button id="musica">Música</button>
</div>
</body>
</html>