-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpainel.js
36 lines (30 loc) · 833 Bytes
/
painel.js
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
function Painel(context, nave) {
this.context = context;
this.nave = nave;
this.spritesheet = new Spritesheet(context, nave.imagem, 3, 2);
this.pontuacao = 0;
}
Painel.prototype = {
atualizar: function() {
},
desenhar: function() {
// Reduz o desenho pela metade
this.context.scale(0.5, 0.5);
var x = 24;
var y = 30;
for (var i = 1; i <= this.nave.vidasExtras; i++) {
this.spritesheet.desenhar(x, y);
x += 60;
}
// Torna a dobrar
this.context.scale(2, 2);
// Para facilitar um pouco...
var ctx = this.context;
// Pontuação
ctx.save();
ctx.fillStyle = 'white';
ctx.font = '18px sans-serif';
ctx.fillText(this.pontuacao, 420, 37);
ctx.restore();
}
}