1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
export const COLORS = {
grid: '#2d2d2d',
walls: '#2d2d2d',
exit: 'teal',
diamond: 'gold',
pentagon: 'blueviolet',
player: 'rgba(0, 237, 209, ',
enemy: 'rgba(255, 155, 28, ',
boss: 'rgba(255, 14, 0, ',
combatDotPlayer: '#00edd1',
combatDotEnemy: '#ff731c',
combatDotBoss: '#b70030'
};
export const CONFIG = {
GRID_SIZE: 6, // 6 is about the smallest allowable level size before the path finding algorithms start to break
PLAYER_HEALTH: 12,
PLAYER_MAX_HEALTH: 16,
PLAYER_BASE_DAMAGE: 1,
ENEMY_CHASE_DISTANCE: 4,
ENEMY_BOSS_OCCURRENCE: 10,
MIN_ENEMIES_ON_LEVEL: 1,
MAX_ENEMIES_ON_LEVEL: 4,
MIN_ENEMY_HEALTH: 2,
MAX_ENEMY_HEALTH: 7,
MIN_ROOM_SIZE: 4,
WALLS_MIN: 7,
WALLS_MAX: 20,
ITEMS_MIN: 1,
ITEMS_MAX: 3,
DOTS_PER_HIT: 7
};
const canvas = document.getElementById('gameCanvas');
const ctx = canvas.getContext('2d');
const tileSize = canvas.width / CONFIG.GRID_SIZE;
export const CANVAS = {
ctx,
canvas,
tileSize,
updateTileSize() {
return canvas.width / CONFIG.GRID_SIZE;
}
};
|