reworked text display, with colors

This commit is contained in:
landgreen
2019-11-03 15:54:34 -08:00
parent 3185c8c180
commit ed993eea21
8 changed files with 212 additions and 316 deletions

View File

@@ -11,7 +11,7 @@ const powerUps = {
let heal = (this.size / 40) ** 2
heal = Math.min(1 - mech.health, heal)
mech.addHealth(heal);
if (!game.lastLogTime && heal > 0) game.makeTextLog('heal for ' + (heal * 100).toFixed(0) + '%', 180)
if (!game.lastLogTime && heal > 0) game.makeTextLog("<span style='font-size:150;'> <span class='color-h'>heal</span> " + (heal * 100).toFixed(0) + "%</span>", 300)
}
},
ammo: {
@@ -41,13 +41,13 @@ const powerUps = {
}
if (target.ammo === Infinity) {
mech.fieldMeter = 1;
if (!game.lastLogTime) game.makeTextLog("+energy", 180);
if (!game.lastLogTime) game.makeTextLog("<span style='font-size:150;'><span class='color-f'>+energy</span></span>", 300);
} else {
//ammo given scales as mobs take more hits to kill
const ammo = Math.ceil((target.ammoPack * (0.6 + 0.04 * Math.random())) / b.dmgScale);
target.ammo += ammo;
game.updateGunHUD();
if (!game.lastLogTime) game.makeTextLog("+" + ammo + " ammo: " + target.name, 180);
if (!game.lastLogTime) game.makeTextLog("<span style='font-size:150;'>+" + ammo + " ammo for " + target.name + "</span>", 300);
}
}
},
@@ -93,7 +93,7 @@ const powerUps = {
if (options.length > 0) {
let newMod = options[Math.floor(Math.random() * options.length)]
b.giveMod(newMod)
game.makeTextLog(`<strong style='font-size:30px;'>${b.mods[newMod].name}</strong><br> <p>${b.mods[newMod].description}</p>`, 1200);
game.makeTextLog(`<strong style='font-size:30px;'>${b.mods[newMod].name}</strong><br><br> ${b.mods[newMod].description}`, 1000);
if (options.length < 2) powerUps.haveAllMods = true
}
}
@@ -117,12 +117,8 @@ const powerUps = {
//give player a gun they don't already have if possible
if (options.length > 0) {
let newGun = options[Math.floor(Math.random() * options.length)];
// newGun = 4; //makes every gun you pick up this type //enable for testing one gun
if (b.activeGun === null) {
b.activeGun = newGun //if no active gun switch to new gun
game.makeTextLog("Use <strong>left mouse</strong> to fire weapon.", Infinity);
}
game.makeTextLog(`<strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br><span class='faded'>(left click)</span><p>${b.guns[newGun].description}</p>`, 1000);
if (b.activeGun === null) b.activeGun = newGun //if no active gun switch to new gun
game.makeTextLog(`<strong style='font-size:30px;'>${b.guns[newGun].name}</strong><br><span class='faded'>(left click)</span><br><br>${b.guns[newGun].description}`, 900);
b.guns[newGun].have = true;
b.inventory.push(newGun);
b.guns[newGun].ammo += b.guns[newGun].ammoPack * 2;
@@ -133,7 +129,7 @@ const powerUps = {
const ammo = Math.ceil(b.guns[ammoTarget].ammoPack * 2);
b.guns[ammoTarget].ammo += ammo;
game.updateGunHUD();
game.makeTextLog("+" + ammo + " ammo: " + b.guns[ammoTarget].name, 180);
game.makeTextLog("<span style='font-size:150;'>+" + ammo + " ammo for " + b.guns[ammoTarget].name + "</span>", 300);
}
}
},