Skip to content

Commit

Permalink
Add confetti and sound effects to game over screen
Browse files Browse the repository at this point in the history
  • Loading branch information
JaZo committed Feb 11, 2025
1 parent 53717aa commit 0e0a5f2
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"core-js": "^3.34.0",
"roboto-fontface": "*",
"vue": "^3.4.0",
"vue-confetti-explosion": "^1.0.2",
"vue-i18n": "^9.14.0",
"vue-router": "^4.3.0",
"vuetify": "^3.5.0",
Expand Down
Binary file added src/assets/sounds/game-over.mp3
Binary file not shown.
23 changes: 23 additions & 0 deletions src/pages/game/GameOver.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
</v-col>
</v-row>

<v-row justify="center">
<ConfettiExplosion />
</v-row>

<v-row>
<v-col>
<v-list>
Expand Down Expand Up @@ -36,10 +40,19 @@

<script>
import {mapState, mapGetters} from 'vuex';
import ConfettiExplosion from 'vue-confetti-explosion';
import mp3 from '../../assets/sounds/game-over.mp3';
const sound = new Audio(mp3);
export default {
components: {
ConfettiExplosion,
},
computed: {
...mapState([
'settings',
'score',
]),
Expand All @@ -50,12 +63,22 @@ export default {
]),
},
mounted() {
this.playSound();
},
methods: {
continueGame() {
this.$store.dispatch('endGame').then(() => {
this.$router.replace({name: 'teams'});
});
},
playSound() {
if (this.settings.sounds) {
sound.play();
}
},
},
};
</script>

0 comments on commit 0e0a5f2

Please sign in to comment.