Skip to content

Commit

Permalink
- Restore maximum lifes on game start
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTimeey committed Feb 20, 2021
1 parent 5b4437e commit a71e681
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/store/life/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ let mutations = {
reduceByOne(state) {
state.currentAmount = state.currentAmount - 1;
},
init(state) {
state.currentAmount = state.maximum;
}
};
let getters = {
isGameOver: (state) => {
Expand Down
1 change: 1 addition & 0 deletions src/views/StartPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
methods: {
async startGame(level) {
this.$store.commit('setLoading', true);
this.$store.commit('life/init');
await this.$store.dispatch('game/initGame');
this.$store.commit('game/startGame', level);
this.$store.commit('setLoading', false);
Expand Down

0 comments on commit a71e681

Please sign in to comment.