43 lines
1.0 KiB
JavaScript
43 lines
1.0 KiB
JavaScript
/*
|
|
* Copyright (c) 2020. Antonio Martinez Casadesus and Pascal Syma.
|
|
* All rights reserved.
|
|
*/
|
|
|
|
export default class Menu extends Phaser.Scene {
|
|
|
|
constructor() {
|
|
super({
|
|
key: "Menu",
|
|
pixelArt: true,
|
|
physics: {
|
|
default: 'arcade',
|
|
arcade: {
|
|
gravity: {y: 0},
|
|
// debug: true
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
create() {
|
|
const w = this.cameras.main.centerX;
|
|
const h = this.cameras.main.centerY;
|
|
|
|
this.anims.create({
|
|
key: 'idle',
|
|
frames: this.anims.generateFrameNumbers('char', {start: 126, end: 131}),
|
|
frameRate: 10,
|
|
repeat: -1
|
|
});
|
|
|
|
[{x: w / 2, y: h / 2, key: 'A'},
|
|
{x: w / 2 + w, y: h / 2, key: 'B'},
|
|
{x: w / 2, y: h / 2 + h, key: 'C'},
|
|
{x: w / 2 + w, y: h / 2 + h, key: 'D'}]
|
|
.forEach((e) => this.addOption(e));
|
|
|
|
}
|
|
|
|
addOption(options) {
|
|
}
|
|
} |