30 lines
977 B
JavaScript
30 lines
977 B
JavaScript
import { ARENA_SIZE, GRID_SIZE, TILE_SIZE } from "../constants.js";
|
|
|
|
export function drawArena(scene) {
|
|
const graphics = scene.add.graphics();
|
|
graphics.fillStyle(0x34351f, 1);
|
|
graphics.fillRect(0, 0, ARENA_SIZE, ARENA_SIZE);
|
|
graphics.fillStyle(0x556235, 0.12);
|
|
|
|
for (let row = 0; row < GRID_SIZE; row += 1) {
|
|
for (let column = 0; column < GRID_SIZE; column += 1) {
|
|
if ((row + column) % 2 === 0) {
|
|
graphics.fillRect(column * TILE_SIZE, row * TILE_SIZE, TILE_SIZE, TILE_SIZE);
|
|
}
|
|
}
|
|
}
|
|
|
|
graphics.lineStyle(1, 0xd3bd72, 0.11);
|
|
|
|
for (let index = 0; index <= GRID_SIZE; index += 1) {
|
|
const offset = index * TILE_SIZE;
|
|
graphics.lineBetween(offset, 0, offset, ARENA_SIZE);
|
|
graphics.lineBetween(0, offset, ARENA_SIZE, offset);
|
|
}
|
|
|
|
graphics.lineStyle(12, 0x17180e, 1);
|
|
graphics.strokeRect(0, 0, ARENA_SIZE, ARENA_SIZE);
|
|
graphics.lineStyle(2, 0xd3bd72, 0.35);
|
|
graphics.strokeRect(12, 12, ARENA_SIZE - 24, ARENA_SIZE - 24);
|
|
}
|