mirror of
https://github.com/Kugelschieber/breach.git
synced 2026-01-18 12:00:25 +00:00
Added start screen with countdown and advancing level.
This commit is contained in:
29
src/App.vue
29
src/App.vue
@@ -3,7 +3,8 @@
|
||||
<Level :level="level" />
|
||||
<Timer />
|
||||
<Buffer />
|
||||
<Matrix />
|
||||
<Matrix v-on:won="level++" v-on:lost="lost = true" />
|
||||
<Start :level="level" v-on:start="nextLevel" />
|
||||
</main>
|
||||
</template>
|
||||
|
||||
@@ -13,6 +14,7 @@
|
||||
import Timer from "./components/Timer.vue";
|
||||
import Buffer from "./components/Buffer.vue";
|
||||
import Matrix from "./components/Matrix.vue";
|
||||
import Start from "./components/Start.vue";
|
||||
import { Game } from "./game/Game";
|
||||
|
||||
export default defineComponent({
|
||||
@@ -20,7 +22,8 @@
|
||||
Level,
|
||||
Timer,
|
||||
Buffer,
|
||||
Matrix
|
||||
Matrix,
|
||||
Start
|
||||
},
|
||||
setup() {
|
||||
const game = ref(new Game({
|
||||
@@ -36,10 +39,28 @@
|
||||
timeoutMilliseconds: 60_000,
|
||||
}));
|
||||
provide("game", game);
|
||||
const level = ref(1);
|
||||
const level = ref(0);
|
||||
const lost = ref(false);
|
||||
|
||||
function nextLevel() {
|
||||
game.value = new Game({
|
||||
matrix: [
|
||||
"AA", "BB", "CC",
|
||||
"DD", "AA", "BB",
|
||||
"CC", "DD", "DD",
|
||||
],
|
||||
sequences: [
|
||||
["DD", "CC", "AA"],
|
||||
],
|
||||
maxBufferLength: 3,
|
||||
timeoutMilliseconds: 60_000,
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
level
|
||||
level,
|
||||
lost,
|
||||
nextLevel
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user