ReOrganizing the code
This commit is contained in:
18
GameIntro.js
Normal file
18
GameIntro.js
Normal file
@ -0,0 +1,18 @@
|
||||
class GameIntro extends Board {
|
||||
constructor(ctx, key) {
|
||||
super(ctx, key);
|
||||
this.controls = {
|
||||
'Space': ()=>this.next(1)
|
||||
}
|
||||
}
|
||||
update() {
|
||||
this.centerText('BreakOut', this.y, '48px', 'Consolas', 'Black');
|
||||
this.centerText('JDG', this.y + 50, '24px', 'Consolas', 'Black');
|
||||
}
|
||||
centerText(txt, y, s, f, c) {
|
||||
this.ctx.font = s + ' ' + f;
|
||||
this.ctx.fillStyle = 'Black';
|
||||
let x = (this.ctx.canvas.width - this.ctx.measureText(txt).width) / 2;
|
||||
this.ctx.fillText(txt, x, y);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user