Tank damage indication, fall damage tweaks
This commit is contained in:
1 parent
edf01cb078
commit
34ba096146
2 files changed
+10
-3
No files matched your search
+2
-2
@@ -71,8 +71,8 @@ export const DEFAULT_KEYPRESS_DELAY = 150;
|
||||
export const PLAYER_MAX_ENERGY = 100;
|
||||
export const PLAYER_ENERGY_POWER_MULTIPLIER = 10;
|
||||
export const PLAYER_INITIAL_POWER = 300;
|
||||
export const PLAYER_FALL_DAMAGE_HEIGHT = 50;
|
||||
export const PLAYER_FALL_DAMAGE_FACTOR = 3;
|
||||
export const PLAYER_FALL_DAMAGE_HEIGHT = 25;
|
||||
export const PLAYER_FALL_DAMAGE_FACTOR = 2;
|
||||
export const PLAYER_EXPLOSION_PARTICLE_POWER = 500;
|
||||
export const PLAYER_TANK_BOUNDING_RADIUS = 4;
|
||||
export const PLAYER_TANK_Y_FOOTPRINT = -2;
|
||||
|
||||
+8
-1
@@ -370,7 +370,7 @@ function draw() {
|
||||
|
||||
function drawPlayers() {
|
||||
for (let player of players) {
|
||||
const {x, y, a, c, cb, dead} = player;
|
||||
const {x, y, a, c, cb, energy, dead} = player;
|
||||
if (dead) continue;
|
||||
const [px, py] = vec(x, y-3, a+180, 3);
|
||||
drawLine(foreground, x-1, y-3, px-1, py, cb);
|
||||
@@ -383,6 +383,13 @@ function drawPlayers() {
|
||||
drawLine(foreground, x, y-3, px, py, c);
|
||||
drawRect(foreground, x-4, y-2, 8, 2, c);
|
||||
drawRect(foreground, x-3, y-0, 6, 1, c);
|
||||
|
||||
const damage = clamp(0, 1 - energy/PLAYER_MAX_ENERGY, 1);
|
||||
foreground.globalAlpha = damage * 0.7;
|
||||
drawRect(foreground, x-4, y-2, 8, 2, cb);
|
||||
foreground.globalAlpha = damage;
|
||||
drawRect(foreground, x-3, y-0, 6, 1, cb);
|
||||
foreground.globalAlpha = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user