codex
This commit is contained in:
@@ -55,14 +55,17 @@ export class EndScene extends Phaser.Scene {
|
||||
circle.setInteractive({ useHandCursor: true });
|
||||
|
||||
// Clic sur le bouton ou n'importe où sur l'écran
|
||||
const startVideo = () => {
|
||||
message.destroy();
|
||||
playButton.destroy();
|
||||
this.playEndVideo();
|
||||
let startRequested = false; // # modifer par codex + ancien code: (aucun)
|
||||
const startVideo = () => { // # modifer par codex + ancien code: const startVideo = () => {
|
||||
if (startRequested) return; // # modifer par codex + ancien code: (aucun)
|
||||
startRequested = true; // # modifer par codex + ancien code: (aucun)
|
||||
message.destroy(); // # modifer par codex + ancien code: message.destroy();
|
||||
playButton.destroy(); // # modifer par codex + ancien code: playButton.destroy();
|
||||
this.playEndVideo(); // # modifer par codex + ancien code: this.playEndVideo();
|
||||
};
|
||||
|
||||
circle.on('pointerdown', startVideo);
|
||||
this.input.once('pointerdown', startVideo);
|
||||
circle.on('pointerdown', startVideo); // # modifer par codex + ancien code: circle.on('pointerdown', startVideo);
|
||||
this.input.once('pointerdown', startVideo); // # modifer par codex + ancien code: this.input.once('pointerdown', startVideo);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,6 +76,8 @@ export class EndScene extends Phaser.Scene {
|
||||
|
||||
console.log('[EndScene] Vidéo dans cache?', this.cache.video.exists('end'));
|
||||
|
||||
if (this.video) return; // # modifer par codex + ancien code: (aucun)
|
||||
|
||||
if (!this.cache.video.exists('end')) {
|
||||
console.warn('[EndScene] Vidéo de fin non trouvée → passage au menu.');
|
||||
this.gotoMenu();
|
||||
@@ -272,15 +277,15 @@ export class EndScene extends Phaser.Scene {
|
||||
private showSuccessMessage(): void {
|
||||
// Message "Niveau 1 réussi!"
|
||||
const successText = this.add.text(
|
||||
this.cameras.main.width / 2,
|
||||
this.cameras.main.height / 2 - 100,
|
||||
'Niveau 1 réussi!',
|
||||
this.cameras.main.width / 2, // # modifer par codex + ancien code: this.cameras.main.width / 2,
|
||||
this.cameras.main.height / 2 + 40, // # modifer par codex + ancien code: this.cameras.main.height / 2 - 100,
|
||||
'Niveau 1 réussi!', // # modifer par codex + ancien code: 'Niveau 1 réussi!',
|
||||
{
|
||||
fontSize: '64px',
|
||||
color: '#FFD700',
|
||||
stroke: '#000000',
|
||||
strokeThickness: 8,
|
||||
fontStyle: 'bold',
|
||||
fontSize: '64px', // # modifer par codex + ancien code: fontSize: '64px',
|
||||
color: '#FFD700', // # modifer par codex + ancien code: color: '#FFD700',
|
||||
stroke: '#000000', // # modifer par codex + ancien code: stroke: '#000000',
|
||||
strokeThickness: 8, // # modifer par codex + ancien code: strokeThickness: 8,
|
||||
fontStyle: 'bold', // # modifer par codex + ancien code: fontStyle: 'bold',
|
||||
}
|
||||
);
|
||||
successText.setOrigin(0.5);
|
||||
@@ -297,7 +302,7 @@ export class EndScene extends Phaser.Scene {
|
||||
});
|
||||
|
||||
// Bouton "Passer au niveau 2"
|
||||
const buttonY = this.cameras.main.height / 2 + 100;
|
||||
const buttonY = this.cameras.main.height / 2 - 100; // # modifer par codex + ancien code: const buttonY = this.cameras.main.height / 2 + 100;
|
||||
|
||||
// Fond du bouton
|
||||
const buttonBg = this.add.rectangle(
|
||||
@@ -305,12 +310,13 @@ export class EndScene extends Phaser.Scene {
|
||||
buttonY,
|
||||
400,
|
||||
80,
|
||||
0x4CAF50
|
||||
0x4CAF50 // # modifer par codex + ancien code: 0x4CAF50
|
||||
);
|
||||
buttonBg.setOrigin(0.5);
|
||||
buttonBg.setDepth(999);
|
||||
buttonBg.setInteractive({ useHandCursor: true });
|
||||
buttonBg.setAlpha(0);
|
||||
buttonBg.setFillStyle(0x4CAF50, 0.8); // # modifer par codex + ancien code: (aucun)
|
||||
buttonBg.setAlpha(0); // # modifer par codex + ancien code: buttonBg.setAlpha(0);
|
||||
|
||||
// Texte du bouton
|
||||
const buttonText = this.add.text(
|
||||
@@ -330,15 +336,15 @@ export class EndScene extends Phaser.Scene {
|
||||
// Animation d'apparition du bouton (un peu après le texte)
|
||||
this.tweens.add({
|
||||
targets: [buttonBg, buttonText],
|
||||
alpha: 1,
|
||||
duration: 600,
|
||||
delay: 400,
|
||||
ease: 'Power2',
|
||||
alpha: 1, // # modifer par codex + ancien code: alpha: 1,
|
||||
duration: 600, // # modifer par codex + ancien code: duration: 600,
|
||||
delay: 400, // # modifer par codex + ancien code: delay: 400,
|
||||
ease: 'Power2', // # modifer par codex + ancien code: ease: 'Power2',
|
||||
});
|
||||
|
||||
// Effet hover sur le bouton
|
||||
buttonBg.on('pointerover', () => {
|
||||
buttonBg.setFillStyle(0x66BB6A);
|
||||
buttonBg.setFillStyle(0x66BB6A, 0.9); // # modifer par codex + ancien code: buttonBg.setFillStyle(0x66BB6A);
|
||||
this.tweens.add({
|
||||
targets: buttonBg,
|
||||
scaleX: 1.05,
|
||||
@@ -348,7 +354,7 @@ export class EndScene extends Phaser.Scene {
|
||||
});
|
||||
|
||||
buttonBg.on('pointerout', () => {
|
||||
buttonBg.setFillStyle(0x4CAF50);
|
||||
buttonBg.setFillStyle(0x4CAF50, 0.8); // # modifer par codex + ancien code: buttonBg.setFillStyle(0x4CAF50);
|
||||
this.tweens.add({
|
||||
targets: buttonBg,
|
||||
scaleX: 1,
|
||||
|
||||
@@ -1142,15 +1142,18 @@ export class GameScene extends Phaser.Scene {
|
||||
this.addScore(500);
|
||||
this.playSfx('sfx_super', 0.6);
|
||||
|
||||
// BONUS DE TEMPS : +5 secondes
|
||||
this.timeRemaining += 5;
|
||||
console.log('⏱️ Super Trésor : +5 secondes ! Temps restant:', this.timeRemaining);
|
||||
// BONUS DE TEMPS : +10 secondes // # modifer par codex + ancien code: // BONUS DE TEMPS : +5 secondes
|
||||
const bonusSeconds = 10; // # modifer par codex + ancien code: (aucun)
|
||||
this.gameStartTime += bonusSeconds * 1000; // # modifer par codex + ancien code: this.gameStartTime -= bonusSeconds * 1000;
|
||||
this.timeRemaining += bonusSeconds; // # modifer par codex + ancien code: this.timeRemaining += 5;
|
||||
this.updateTimer(this.time.now); // # modifer par codex + ancien code: (aucun)
|
||||
console.log('⏱️ Super Trésor : +10 secondes ! Temps restant:', this.timeRemaining); // # modifer par codex + ancien code: console.log('⏱️ Super Trésor : +5 secondes ! Temps restant:', this.timeRemaining);
|
||||
|
||||
// Message spécial
|
||||
const bonusText = this.add.text(
|
||||
this.cameras.main.scrollX + this.cameras.main.width / 2,
|
||||
this.cameras.main.height / 2,
|
||||
'★ SUPER TRÉSOR +500 ★\n⏱️ +5 SECONDES ⏱️',
|
||||
'★ SUPER TRÉSOR +500 ★\n⏱️ +10 SECONDES ⏱️', // # modifer par codex + ancien code: '★ SUPER TRÉSOR +500 ★\n⏱️ +5 SECONDES ⏱️',
|
||||
{
|
||||
fontSize: '48px',
|
||||
color: '#FFD700',
|
||||
|
||||
Reference in New Issue
Block a user