Constants cleanup
This commit is contained in:
1 parent
c5ead3632f
commit
a1c2cdd937
3 files changed
+53
-51
No files matched your search
+50
-7
@@ -2,6 +2,15 @@ export const W = 640;
|
|||||||
export const H = 400;
|
export const H = 400;
|
||||||
export const Z = 2;
|
export const Z = 2;
|
||||||
|
|
||||||
|
export const SKY_COLORS = [
|
||||||
|
{from:[42, 78, 108], to:[0, 0, 0]},
|
||||||
|
{from:[82, 120, 187], to:[201, 218, 236]},
|
||||||
|
{from:[94, 171, 184], to:[225, 172, 139]},
|
||||||
|
{from:[49, 76, 148], to:[242, 171, 85]},
|
||||||
|
{from:[51, 89, 135], to:[163, 198, 220]},
|
||||||
|
{from:[105, 95, 108], to:[223, 183, 110]},
|
||||||
|
];
|
||||||
|
|
||||||
export const MAX_PLAYERS = 6;
|
export const MAX_PLAYERS = 6;
|
||||||
|
|
||||||
export const PLAYER_COLORS = [
|
export const PLAYER_COLORS = [
|
||||||
@@ -13,13 +22,47 @@ export const PLAYER_COLORS = [
|
|||||||
['blueviolet', 'indigo'],
|
['blueviolet', 'indigo'],
|
||||||
];
|
];
|
||||||
|
|
||||||
export const SKY_COLORS = [
|
export const PLAYER_STARTING_WEAPONS = [
|
||||||
{from:[42, 78, 108], to:[0, 0, 0]},
|
{type: 'babyMissile', ammo:Infinity},
|
||||||
{from:[82, 120, 187], to:[201, 218, 236]},
|
{type: 'missile', ammo:5},
|
||||||
{from:[94, 171, 184], to:[225, 172, 139]},
|
{type: 'babyNuke', ammo:3},
|
||||||
{from:[49, 76, 148], to:[242, 171, 85]},
|
{type: 'nuke', ammo:1},
|
||||||
{from:[51, 89, 135], to:[163, 198, 220]},
|
{type: 'smallDirt', ammo:5},
|
||||||
{from:[105, 95, 108], to:[223, 183, 110]},
|
{type: 'dirt', ammo:3},
|
||||||
|
{type: 'largeDirt', ammo:1},
|
||||||
|
{type: 'smallDigBomb', ammo:5},
|
||||||
|
{type: 'digBomb', ammo:3},
|
||||||
|
{type: 'largeDigBomb', ammo:1},
|
||||||
|
{type: 'tracer', ammo:Infinity},
|
||||||
|
]
|
||||||
|
|
||||||
|
export const WEAPON_TYPES = [
|
||||||
|
{id:'tracer', name:'Tracer', explosion:{type:'tracer'}},
|
||||||
|
{id:'babyMissile', name:'Baby Missile', explosion:{type:'blast', r:5}},
|
||||||
|
{id:'missile', name:'Missile', explosion:{type:'blast', r:20}},
|
||||||
|
{id:'babyNuke', name:'Baby Nuke', explosion:{type:'blast', r:50}},
|
||||||
|
{id:'nuke', name:'Nuke', explosion:{type:'blast', r:100}},
|
||||||
|
{id:'smallDirt', name:'Small Dirt', explosion:{type:'dirt', r:25}},
|
||||||
|
{id:'dirt', name:'Dirt', explosion:{type:'dirt', r:50}},
|
||||||
|
{id:'largeDirt', name:'Ton of Dirt', explosion:{type:'dirt', r:75}},
|
||||||
|
{id:'smallDigBomb', name:'Small Dig Bomb', explosion:{type:'digBomb', r:25}},
|
||||||
|
{id:'digBomb', name:'Dig Bomb', explosion:{type:'digBomb', r:50}},
|
||||||
|
{id:'largeDigBomb', name:'Large Dig Bomb', explosion:{type:'digBomb', r:75}},
|
||||||
|
];
|
||||||
|
|
||||||
|
export const DEATH_SPECS = [
|
||||||
|
{type: 'blast', r: 15},
|
||||||
|
{type: 'blast', r: 30},
|
||||||
|
{type: 'blast', r: 60},
|
||||||
|
{type: 'dirt', r: 25},
|
||||||
|
{type: 'dirt', r: 50},
|
||||||
|
{type: 'dirt', r: 75},
|
||||||
|
{type: 'digBomb', r: 25},
|
||||||
|
{type: 'digBomb', r: 50},
|
||||||
|
{type: 'digBomb', r: 75},
|
||||||
|
{type: 'dirtCone', r: 50},
|
||||||
|
{type: 'dirtCone', r: 100},
|
||||||
|
{type: 'dirtCone', r: 150},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const MAX_WIND = 25;
|
export const MAX_WIND = 25;
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import {H, PROJECTILE_MAX_SOUND_FREQUENCY, MAX_WIND, PROJECTILE_MIN_SOUND_FREQUENCY, PLAYER_COLORS, PLAYER_INITIAL_POWER, PROJECTILE_POWER_REDUCTION_FACTOR, W, Z, PROJECTILE_ITERATIONS_PER_FRAME, PROJECTILE_ITERATION_PROGRESS, PLAYER_MAX_ENERGY, PLAYER_ENERGY_POWER_MULTIPLIER, PLAYER_FALL_DAMAGE_FACTOR, PLAYER_FALL_DAMAGE_HEIGHT, PLAYER_WEAPON_CHANGE_DELAY, PARTICLE_AMOUNT, PROJECTILE_WIND_REDUCTION_FACTOR, PARTICLE_POWER_REDUCTION_FACTOR, PARTICLE_WIND_REDUCTION_FACTOR, PARTICLE_MIN_POWER_FACTOR, PARTICLE_MAX_POWER_FACTOR, PARTICLE_MIN_LIFETIME, PARTICLE_TIME_FACTOR, PLAYER_EXPLOSION_PARTICLE_POWER, EXPLOSION_SHAKE_REDUCTION_FACTOR, MAX_EXPLOSION_SHAKE_FACTOR, TRAJECTORY_FADE_SPEED, PARTICLE_FADE_AMOUNT, TRAJECTORY_FLOAT_SPEED, PLAYER_TANK_BOUNDING_RADIUS} from './constants.js';
|
import {H, PROJECTILE_MAX_SOUND_FREQUENCY, MAX_WIND, PROJECTILE_MIN_SOUND_FREQUENCY, PLAYER_COLORS, PLAYER_INITIAL_POWER, PROJECTILE_POWER_REDUCTION_FACTOR, W, Z, PROJECTILE_ITERATIONS_PER_FRAME, PROJECTILE_ITERATION_PROGRESS, PLAYER_MAX_ENERGY, PLAYER_ENERGY_POWER_MULTIPLIER, PLAYER_FALL_DAMAGE_FACTOR, PLAYER_FALL_DAMAGE_HEIGHT, PLAYER_WEAPON_CHANGE_DELAY, PARTICLE_AMOUNT, PROJECTILE_WIND_REDUCTION_FACTOR, PARTICLE_POWER_REDUCTION_FACTOR, PARTICLE_WIND_REDUCTION_FACTOR, PARTICLE_MIN_POWER_FACTOR, PARTICLE_MAX_POWER_FACTOR, PARTICLE_MIN_LIFETIME, PARTICLE_TIME_FACTOR, PLAYER_EXPLOSION_PARTICLE_POWER, EXPLOSION_SHAKE_REDUCTION_FACTOR, MAX_EXPLOSION_SHAKE_FACTOR, TRAJECTORY_FADE_SPEED, PARTICLE_FADE_AMOUNT, TRAJECTORY_FLOAT_SPEED, PLAYER_TANK_BOUNDING_RADIUS, PLAYER_STARTING_WEAPONS, WEAPON_TYPES, DEATH_SPECS} from './constants.js';
|
||||||
import {createCanvas, drawLine, drawRect, drawText, loop, plot, drawLineVirtual} from './gfx.js';
|
import {createCanvas, drawLine, drawRect, drawText, loop, plot, drawLineVirtual} from './gfx.js';
|
||||||
import {key} from './input.js';
|
import {key} from './input.js';
|
||||||
import {clamp, deg2rad, parable, randomInt, vec, wrap, random, within} from './math.js';
|
import {clamp, deg2rad, parable, randomInt, vec, wrap, random, within} from './math.js';
|
||||||
import {createSky} from './sky.js';
|
import {createSky} from './sky.js';
|
||||||
import {audio, createOsc, playTickSound} from './sound.js';
|
import {audio, createOsc, playTickSound} from './sound.js';
|
||||||
import {collapseTerrain, createTerrain, isTerrain, landHeight, closestLand, clipTerrain} from './terrain.js';
|
import {collapseTerrain, createTerrain, isTerrain, landHeight, closestLand, clipTerrain} from './terrain.js';
|
||||||
import {WEAPON_TYPES, EXPLOSION_TYPES, DEATH_SPECS} from './weapons.js';
|
import {EXPLOSION_TYPES} from './weapons.js';
|
||||||
import {sample} from './utils.js';
|
import {sample} from './utils.js';
|
||||||
import {AI_TYPES} from './ai.js';
|
import {AI_TYPES} from './ai.js';
|
||||||
|
|
||||||
@@ -44,19 +44,7 @@ for (let [color, borderColor] of PLAYER_COLORS) {
|
|||||||
x, y, a,
|
x, y, a,
|
||||||
c: color, cb: borderColor,
|
c: color, cb: borderColor,
|
||||||
p: PLAYER_INITIAL_POWER,
|
p: PLAYER_INITIAL_POWER,
|
||||||
weapons: [
|
weapons: [...PLAYER_STARTING_WEAPONS],
|
||||||
{type: 'babyMissile', ammo:Infinity},
|
|
||||||
{type: 'missile', ammo:5},
|
|
||||||
{type: 'babyNuke', ammo:3},
|
|
||||||
{type: 'nuke', ammo:1},
|
|
||||||
{type: 'smallDirt', ammo:5},
|
|
||||||
{type: 'dirt', ammo:3},
|
|
||||||
{type: 'largeDirt', ammo:1},
|
|
||||||
{type: 'smallDigBomb', ammo:5},
|
|
||||||
{type: 'digBomb', ammo:3},
|
|
||||||
{type: 'largeDigBomb', ammo:1},
|
|
||||||
{type: 'tracer', ammo:Infinity},
|
|
||||||
],
|
|
||||||
currentWeapon: 0,
|
currentWeapon: 0,
|
||||||
energy: PLAYER_MAX_ENERGY,
|
energy: PLAYER_MAX_ENERGY,
|
||||||
ai: i !== 0 ? 'moron' : undefined,
|
ai: i !== 0 ? 'moron' : undefined,
|
||||||
|
|||||||
-29
@@ -12,35 +12,6 @@ export function drawDirt(ctx, x, y, r, c) {
|
|||||||
drawCircle(ctx, x, y, r, c);
|
drawCircle(ctx, x, y, r, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
export const WEAPON_TYPES = [
|
|
||||||
{id:'tracer', name:'Tracer', explosion:{type:'tracer'}},
|
|
||||||
{id:'babyMissile', name:'Baby Missile', explosion:{type:'blast', r:5}},
|
|
||||||
{id:'missile', name:'Missile', explosion:{type:'blast', r:20}},
|
|
||||||
{id:'babyNuke', name:'Baby Nuke', explosion:{type:'blast', r:50}},
|
|
||||||
{id:'nuke', name:'Nuke', explosion:{type:'blast', r:100}},
|
|
||||||
{id:'smallDirt', name:'Small Dirt', explosion:{type:'dirt', r:25}},
|
|
||||||
{id:'dirt', name:'Dirt', explosion:{type:'dirt', r:50}},
|
|
||||||
{id:'largeDirt', name:'Ton of Dirt', explosion:{type:'dirt', r:75}},
|
|
||||||
{id:'smallDigBomb', name:'Small Dig Bomb', explosion:{type:'digBomb', r:25}},
|
|
||||||
{id:'digBomb', name:'Dig Bomb', explosion:{type:'digBomb', r:50}},
|
|
||||||
{id:'largeDigBomb', name:'Large Dig Bomb', explosion:{type:'digBomb', r:75}},
|
|
||||||
];
|
|
||||||
|
|
||||||
export const DEATH_SPECS = [
|
|
||||||
{type: 'blast', r: 15},
|
|
||||||
{type: 'blast', r: 30},
|
|
||||||
{type: 'blast', r: 60},
|
|
||||||
{type: 'dirt', r: 25},
|
|
||||||
{type: 'dirt', r: 50},
|
|
||||||
{type: 'dirt', r: 75},
|
|
||||||
{type: 'digBomb', r: 25},
|
|
||||||
{type: 'digBomb', r: 50},
|
|
||||||
{type: 'digBomb', r: 75},
|
|
||||||
{type: 'dirtCone', r: 50},
|
|
||||||
{type: 'dirtCone', r: 100},
|
|
||||||
{type: 'dirtCone', r: 150},
|
|
||||||
];
|
|
||||||
|
|
||||||
export const EXPLOSION_TYPES = {
|
export const EXPLOSION_TYPES = {
|
||||||
tracer: {
|
tracer: {
|
||||||
create(spec, x, y) {
|
create(spec, x, y) {
|
||||||
|
|||||||
Reference in new issue
Block a user