Move the board into a writable store
This commit is contained in:
parent
4ca083e570
commit
9508a7e66a
2 changed files with 13 additions and 33 deletions
|
|
@ -1,38 +1,18 @@
|
|||
<script lang="ts">
|
||||
import Spaceship from "./icons/spaceship.svelte";
|
||||
import Hexagon from "./Hexagon.svelte";
|
||||
import type { PlayerData } from "common";
|
||||
import { board } from "../stores";
|
||||
|
||||
const board: PlayerData[] = new Array(54).fill(null);
|
||||
|
||||
board[5] = {
|
||||
colour: {
|
||||
name: "Green",
|
||||
hex: `#00aa00`
|
||||
},
|
||||
name: `Oliver`,
|
||||
ship: {
|
||||
id: `space-shuttle`,
|
||||
name: `Space Shuttle`
|
||||
},
|
||||
host: false,
|
||||
}
|
||||
board[18] = {
|
||||
colour: {
|
||||
name: "Pink",
|
||||
hex: `#f72585`
|
||||
},
|
||||
name: `Oliver`,
|
||||
ship: {
|
||||
id: `space-shuttle`,
|
||||
name: `Space Shuttle`
|
||||
},
|
||||
host: false,
|
||||
}
|
||||
|
||||
function calculateMidNumber(row: number, col: number) {
|
||||
return col + (( row * 10 ) + (1 * row));
|
||||
};
|
||||
const ship = `space-shuttle`
|
||||
// board[5] = {colour: {name: "Green",hex: `#00aa00`},name: `Oliver`,ship: {id: ship,name: `Space Shuttle`},host: false,}
|
||||
// board[10] = {colour: {name: "Magenta",hex: `#0077b6`},name: `Oliver`,ship: {id: ship,name: `Space Shuttle`},host: false,}
|
||||
// board[18] = {colour: {name: "Pink",hex: `#cb0b0a`},name: `Oliver`,ship: {id: ship,name: `Space Shuttle`},host: false,}
|
||||
// board[21] = {colour: {name: "Magenta",hex: `#7400b8`},name: `Oliver`,ship: {id: ship,name: `Space Shuttle`},host: false,}
|
||||
// board[26] = {colour: {name: "Magenta",hex: `#faa307`},name: `Oliver`,ship: {id: ship,name: `Space Shuttle`},host: false,}
|
||||
// board[32] = {colour: {name: "Magenta",hex: `#9ef01a`},name: `Oliver`,ship: {id: ship,name: `Space Shuttle`},host: false,}
|
||||
// board[43] = {colour: {name: "Magenta",hex: `#b7094c`},name: `Oliver`,ship: {id: ship,name: `Space Shuttle`},host: false,}
|
||||
// board[47] = {colour: {name: "Magenta",hex: `#f72585`},name: `Oliver`,ship: {id: ship,name: `Space Shuttle`},host: false,}
|
||||
board[53] = {colour: {name: "Magenta",hex: `#f9c80e`},name: `Oliver`,ship: {id: ship,name: `Space Shuttle`},host: false,}
|
||||
</script>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import type { PlayerData } from "common";
|
||||
import type { Board, PlayerData } from "common";
|
||||
import { writable } from "svelte/store";
|
||||
|
||||
export const gameCode = writable<string>("");
|
||||
export const state = writable<string>("main-menu");
|
||||
export const myName = writable<string>("");
|
||||
export const isHost = writable<boolean>(false);
|
||||
export const players = writable<PlayerData[]>();
|
||||
export const board = writable<Board>(new Array(54).fill(null));
|
||||
Loading…
Add table
Add a link
Reference in a new issue