Tank particles use player color
This commit is contained in:
1 parent
ebe233c88a
commit
abbe12f9ff
2 files changed
+9
-9
No files matched your search
+1
-1
@@ -29,6 +29,7 @@ export const PLAYER_ENERGY_POWER_MULTIPLIER = 10;
|
|||||||
export const PLAYER_INITIAL_POWER = 300;
|
export const PLAYER_INITIAL_POWER = 300;
|
||||||
export const PLAYER_FALL_DAMAGE_HEIGHT = 50;
|
export const PLAYER_FALL_DAMAGE_HEIGHT = 50;
|
||||||
export const PLAYER_FALL_DAMAGE_FACTOR = 3;
|
export const PLAYER_FALL_DAMAGE_FACTOR = 3;
|
||||||
|
export const PLAYER_WEAPON_CHANGE_DELAY = 150;
|
||||||
export const PLAYER_EXPLOSION_PARTICLE_POWER = 500;
|
export const PLAYER_EXPLOSION_PARTICLE_POWER = 500;
|
||||||
|
|
||||||
export const PROJECTILE_POWER_REDUCTION_FACTOR = 10;
|
export const PROJECTILE_POWER_REDUCTION_FACTOR = 10;
|
||||||
@@ -47,7 +48,6 @@ export const PARTICLE_MIN_LIFETIME = 5;
|
|||||||
export const PARTICLE_TIME_FACTOR = 13;
|
export const PARTICLE_TIME_FACTOR = 13;
|
||||||
export const PARTICLE_POWER_REDUCTION_FACTOR = 15;
|
export const PARTICLE_POWER_REDUCTION_FACTOR = 15;
|
||||||
export const PARTICLE_WIND_REDUCTION_FACTOR = 3;
|
export const PARTICLE_WIND_REDUCTION_FACTOR = 3;
|
||||||
export const PLAYER_WEAPON_CHANGE_DELAY = 150;
|
|
||||||
export const PARTICLE_FADE_AMOUNT = 1;
|
export const PARTICLE_FADE_AMOUNT = 1;
|
||||||
|
|
||||||
export const MAX_EXPLOSION_SHAKE_FACTOR = 60;
|
export const MAX_EXPLOSION_SHAKE_FACTOR = 60;
|
||||||
|
|||||||
@@ -160,7 +160,8 @@ function update() {
|
|||||||
const explosionSpec = weapon.explosion;
|
const explosionSpec = weapon.explosion;
|
||||||
const explosionType = EXPLOSION_TYPES[explosionSpec.type];
|
const explosionType = EXPLOSION_TYPES[explosionSpec.type];
|
||||||
explosion = explosionType.create(explosionSpec, projectile.x, projectile.y);
|
explosion = explosionType.create(explosionSpec, projectile.x, projectile.y);
|
||||||
createParticles(projectile.x, projectile.y, projectile.p);
|
// @ts-ignore: canvas color hack
|
||||||
|
createParticles(projectile.x, projectile.y, projectile.p, terrain.color);
|
||||||
state = 'explosion';
|
state = 'explosion';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -228,11 +229,11 @@ function update() {
|
|||||||
const dyingPlayer = players.find(x => x.energy<=0 && !x.dead);
|
const dyingPlayer = players.find(x => x.energy<=0 && !x.dead);
|
||||||
if (!dyingPlayer) {state = 'end-turn'; return}
|
if (!dyingPlayer) {state = 'end-turn'; return}
|
||||||
|
|
||||||
const {x, y} = dyingPlayer;
|
const {x, y, c} = dyingPlayer;
|
||||||
const explosionSpec = sample(DEATH_SPECS);
|
const explosionSpec = sample(DEATH_SPECS);
|
||||||
const explosionType = EXPLOSION_TYPES[explosionSpec.type];
|
const explosionType = EXPLOSION_TYPES[explosionSpec.type];
|
||||||
explosion = explosionType.create(explosionSpec, x, y);
|
explosion = explosionType.create(explosionSpec, x, y);
|
||||||
createParticles(x, y, PLAYER_EXPLOSION_PARTICLE_POWER);
|
createParticles(x, y, PLAYER_EXPLOSION_PARTICLE_POWER, c);
|
||||||
dyingPlayer.dead = true;
|
dyingPlayer.dead = true;
|
||||||
state = 'explosion';
|
state = 'explosion';
|
||||||
}
|
}
|
||||||
@@ -276,17 +277,16 @@ function update() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createParticles(x, y, p) {
|
function createParticles(x, y, p, c) {
|
||||||
for (let i = 0; i < PARTICLE_AMOUNT; i++) {
|
for (let i = 0; i < PARTICLE_AMOUNT; i++) {
|
||||||
particles.push({
|
particles.push({
|
||||||
|
t: 0,
|
||||||
ox: x, x: x,
|
ox: x, x: x,
|
||||||
oy: y, y: y,
|
oy: y, y: y,
|
||||||
p: p * random(PARTICLE_MIN_POWER_FACTOR, PARTICLE_MAX_POWER_FACTOR),
|
|
||||||
a: randomInt(0, 359),
|
a: randomInt(0, 359),
|
||||||
t: 0,
|
p: p * random(PARTICLE_MIN_POWER_FACTOR, PARTICLE_MAX_POWER_FACTOR),
|
||||||
// @ts-ignore: canvas color hack
|
// @ts-ignore: canvas color hack
|
||||||
c: terrain.color,
|
c, alpha: 255,
|
||||||
alpha: 255,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user