-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameConstants.ts
More file actions
23 lines (22 loc) · 1.13 KB
/
Copy pathGameConstants.ts
File metadata and controls
23 lines (22 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const urlParams = new URLSearchParams(window.location.search);
export const GameConstants = {
// world size in pixels
boundaryWidth: 8000,
boundaryHeight: 6000,
// ship velocity in pixels per second
maxShipVelocity: parseFloat(urlParams.get('maxShipVelocity') ?? '70'),
// radians per frame
shipTurnRate: parseFloat(urlParams.get('shipTurnRate') ?? '0.1'),
shipAccelerationRate: parseFloat(urlParams.get('shipAccelerationRate') ?? '1'),
explosionRadius: parseFloat(urlParams.get('explosionRadius') ?? '20'),
torpedoSpeed: parseFloat(urlParams.get('torpedoSpeed') ?? '100'),
// blast time in miliseconds
torpedoBlastTime: parseFloat(urlParams.get('torpedoBlastTime') ?? '700'),
torpedoBays: parseFloat(urlParams.get('torpedoBays') ?? '5'),
// torpedo reload time in miliseconds
torpedoReloadTime: parseFloat(urlParams.get('torpedoReloadTime') ?? '1000'),
enemyShipCount: parseFloat(urlParams.get('enemyShipCount') ?? '4'),
// respawn time in seconds
respawnTime: parseFloat(urlParams.get('respawnTime') ?? '5'),
asteroidCount: parseFloat(urlParams.get('asteroidCount') ?? '600'),
}