feat: darken players when on the lower part of a map

This commit is contained in:
Janek 2024-05-22 22:39:37 +02:00
parent 2e48662644
commit 01beb3b180
3 changed files with 30 additions and 11 deletions

@ -3,5 +3,6 @@
"pos_y": 2887.0,
"scale": 7.0,
"rotate": 0,
"zoom": 0.0
"zoom": 0.0,
"altitude_split": -495
}

@ -3,5 +3,6 @@
"pos_y": 1762.0,
"scale": 4.0,
"rotate": 0,
"zoom": 0.0
"zoom": 0.0,
"altitude_split": 11700
}

@ -1,7 +1,10 @@
// Colors
const localColor = "#109856"
const localLowerColor = "#064024"
const teamColor = "#68a3e5"
const teamLowerColor = "#2c4969"
const enemyColor = "#ec040b"
const enemyLowerColor = "#4f0002"
const bombColor = "#eda338"
const textColor = "#d1d1d1"
@ -35,7 +38,7 @@ if (location.protocol == 'https:') {
} else {
websocketAddr = `ws://${window.location.host}/ws`
}
//websocketAddr = "ws://192.168.0.235:8000/ws"
websocketAddr = "ws://192.168.0.235:8000/ws"
// Util functions
const clamp = (num, min, max) => Math.min(Math.max(num, min), max);
@ -154,16 +157,30 @@ function render() {
if (data.Bomb !== undefined) {
drawBomb(data.Bomb.pos, data.Bomb.isPlanted)
} else {
let fillStyle = localColor
let fillStyle = localLowerColor
switch (data.Player.playerType) {
case "Team":
fillStyle = teamColor
break;
if (map && map.altitude_split && data.Player.pos.z < map.altitude_split) {
case "Enemy":
fillStyle = enemyColor
break;
switch (data.Player.playerType) {
case "Team":
fillStyle = teamLowerColor
break;
case "Enemy":
fillStyle = enemyLowerColor
break;
}
} else {
fillStyle = localColor
switch (data.Player.playerType) {
case "Team":
fillStyle = teamColor
break;
case "Enemy":
fillStyle = enemyColor
break;
}
}
drawEntity(