25 lines
653 B
Svelte
25 lines
653 B
Svelte
<script>
|
|
import Router from 'svelte-spa-router';
|
|
|
|
// importing all the different screens
|
|
import Home from './routes/Home.svelte';
|
|
import LevelSelect from './routes/LevelSelect.svelte';
|
|
import Game from './routes/Game.svelte';
|
|
import GameOver from './routes/GameOver.svelte';
|
|
|
|
// this is the application of the svelte-spa-router
|
|
// e.g. /#/game will show the Game component
|
|
// this is kind of like switching between HTML pages but we switch components instead
|
|
const routes = {
|
|
'/': Home,
|
|
'/levelselect': LevelSelect,
|
|
'/game': Game,
|
|
'/gameover': GameOver,
|
|
};
|
|
</script>
|
|
|
|
<!-- the router swaps components based on URL -->
|
|
<Router {routes} />
|
|
|
|
|
|
|