Skip to content

Commit c2bdd3e

Browse files
committed
feat: add win condition
1 parent a3f37f1 commit c2bdd3e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

js/src/views/SpaceGame.vue

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import { reactive, toRefs } from 'vue'
2+
import { reactive, toRefs, watch } from 'vue'
33
import MiniGame from '../components/MiniGame'
44
import MiniGame2 from '../components/MiniGame2'
55
import MiniGame3 from '../components/MiniGame3'
@@ -22,6 +22,15 @@ export default {
2222
miniGamesWon: 0
2323
})
2424
25+
watch(
26+
() => user.miniGamesWon,
27+
currentValue => {
28+
if (currentValue === 3) {
29+
state.gameStatus = 'Player wins!'
30+
}
31+
}
32+
)
33+
2534
const startGame = () => {
2635
state.gameStatus = 'Game Started'
2736
}

0 commit comments

Comments
 (0)