Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucien-TFE committed May 12, 2024
1 parent b2e9aa5 commit 1e34886
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@
font-size: 16px;
text-align: center;
}

</style>
</head>
<body>
<button id="startGameButton" class="button">Démarrer le jeu</button>
<div id="game-container" style="flex: 1; display: none; justify-content: center; align-items: center;">
<!-- Le reste de votre contenu de jeu ici -->
<div id="game-container" style="flex: 1; display: flex; justify-content: center; align-items: center;">
<div id="end-popup">
<p id="final-score" style="font-size: 20px; font-weight: bold;">Score: 0</p>
Expand All @@ -57,6 +61,7 @@
<p id="record-message" style="color: red; font-size: 16px;"></p>
</div>
</div>
</div>

<script src="https://cdn.jsdelivr.net/npm/phaser@3/dist/phaser.min.js"></script>
<script>
Expand Down Expand Up @@ -93,6 +98,17 @@
var gameDuration = 30000; // Duration of the game in milliseconds, e.g., 30000 for 30 seconds
var gameOver = false; // Ajout de la variable gameOver

document.getElementById('startGameButton').addEventListener('click', function() {
document.getElementById('game-container').style.display = 'flex'; // Rendre le conteneur du jeu visible
startGame(); // Fonction pour initialiser le jeu
});

function startGame() {
if (!game.isRunning) {
game = new Phaser.Game(config); // Assurez-vous que cette ligne ne crée pas de nouvelles instances à chaque fois
}
}

function preload() {
this.load.image('sky', 'assets/sky.jpg');
this.load.image('biere', 'assets/biere.png');
Expand Down

0 comments on commit 1e34886

Please sign in to comment.