-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobals.js
62 lines (48 loc) · 1.43 KB
/
globals.js
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// Copyright(C) 2024 Alessandro Amatucci Girlanda
// This file is part of Snako.
// Snako is free software: you can redistribute it and / or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Snako is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Snako.If not, see < https://www.gnu.org/licenses/>.
// Grid - Map
const rectSide = 800,
rectHalfSide = rectSide / 2,
FONT = "30px Arial",
// Entities
EMPTY = 0,
FOOD = 1,
WALL = 2,
// Grid
gridCols = 25,
gridRows = 25,
// Cells
cellWidth = rectSide / gridCols,
cellHeight = rectSide / gridRows,
// Time
rr = 1000 / 4,
// Buttons
buttonWidth = 200,
buttonHeight = 50,
// Directions
UP = 0,
RIGHT = Math.PI * 0.5,
DOWN = Math.PI,
LEFT = Math.PI * 1.5,
// Snake
HEAD = 0,
NONE = 1,
BODY = 2,
BODYT = 3,
TAIL = 4,
TAILT = 5,
snakeSectionsStart = 3,
snakeStartX = Math.floor(gridCols / 2),
snakeStartY = Math.floor(gridRows / 2),
snakeStartDir = UP,
snakeSpeed = 1;