snake field is now gray instead of white

This commit is contained in:
2024-02-14 18:55:10 +01:00
parent 1ef9993d67
commit 21cdff237c

View File

@@ -18,7 +18,7 @@ const backendUrl = import.meta.env.MODE === "production"
interface Cell { interface Cell {
x: number x: number
y: number y: number
color: 'white' | 'red' | 'green' color: '#242424' | 'red' | 'green'
} }
interface Snake { interface Snake {
@@ -40,7 +40,7 @@ function genGrid(length: number, height: number) {
currentRow[j] = { currentRow[j] = {
x: i, x: i,
y: j, y: j,
color: 'white' color: '#242424'
} }
} }
grid[i] = currentRow grid[i] = currentRow
@@ -101,7 +101,7 @@ function moveSnake(x: number, y: number) {
const toDelete = snake.value.history.shift() const toDelete = snake.value.history.shift()
if (toDelete !== undefined) { if (toDelete !== undefined) {
toDelete.color = 'white' toDelete.color = '#242424'
} }
} }
@@ -133,13 +133,13 @@ function death() {
function killSnake() { function killSnake() {
snake.value.history snake.value.history
for (const cell of snake.value.history) { for (const cell of snake.value.history) {
cell.color = 'white' cell.color = '#242424'
} }
} }
function killCoin() { function killCoin() {
const coinCell = grid.value[currentCoin.value.x][currentCoin.value.y] const coinCell = grid.value[currentCoin.value.x][currentCoin.value.y]
coinCell.color = 'white' coinCell.color = '#242424'
} }
const speed = computed(() => { const speed = computed(() => {
@@ -289,6 +289,7 @@ window.addEventListener('keydown', keydown)
-moz-box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.75); -moz-box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.75);
box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.75); box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.75);
height: 100%; height: 100%;
background-color: black;
} }
.row { .row {
@@ -318,6 +319,7 @@ main {
-webkit-box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.75); -webkit-box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.75); -moz-box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.75);
box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.75); box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.75);
background-color: black;
} }
.scoreboard-list { .scoreboard-list {