56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
import Phaser from 'phaser';
|
|
|
|
/**
|
|
* Scène de démarrage - Charge les assets de base
|
|
*/
|
|
export class BootScene extends Phaser.Scene {
|
|
constructor() {
|
|
super({ key: 'BootScene' });
|
|
}
|
|
|
|
preload(): void {
|
|
// Barre de chargement
|
|
const width = this.cameras.main.width;
|
|
const height = this.cameras.main.height;
|
|
|
|
const progressBar = this.add.graphics();
|
|
const progressBox = this.add.graphics();
|
|
progressBox.fillStyle(0x222222, 0.8);
|
|
progressBox.fillRect(width / 2 - 160, height / 2 - 30, 320, 50);
|
|
|
|
const loadingText = this.make.text({
|
|
x: width / 2,
|
|
y: height / 2 - 50,
|
|
text: 'Chargement...',
|
|
style: {
|
|
font: '20px Arial',
|
|
color: '#ffffff',
|
|
},
|
|
});
|
|
loadingText.setOrigin(0.5, 0.5);
|
|
|
|
// Progression
|
|
this.load.on('progress', (value: number) => {
|
|
progressBar.clear();
|
|
progressBar.fillStyle(0x4CAF50, 1);
|
|
progressBar.fillRect(width / 2 - 150, height / 2 - 20, 300 * value, 30);
|
|
});
|
|
|
|
this.load.on('complete', () => {
|
|
progressBar.destroy();
|
|
progressBox.destroy();
|
|
loadingText.destroy();
|
|
});
|
|
|
|
// Charger les assets de base ici
|
|
// Exemple : this.load.image('logo', 'assets/logo.png');
|
|
|
|
// TODO: Charger sprites, backgrounds, sons, etc.
|
|
}
|
|
|
|
create(): void {
|
|
// Passer à la scène Menu
|
|
this.scene.start('MenuScene');
|
|
}
|
|
}
|