elasticity

tech: elasticity - skin, does "crouch landings" a tiny bit more
  jump and move faster, +15% defense
  (replaces squirrel cage rotor)

tech: diaphragm -  skin, defense cycles between -33% and +100%
  requires aperture

tungsten carbide 150->200 maximum health
  but now does "crouch landings" a more
Zectron damage 80->100% and it does a bit less harm to player
flip-flop, relay switch are no longer skins

pause brings up the most recent in game console message
  in game console no longer fades out it just instantly goes on and off

bug fixes
This commit is contained in:
landgreen
2023-02-07 15:41:42 -08:00
parent 6814c104a1
commit 9402cf2fe0
13 changed files with 500 additions and 250 deletions

View File

@@ -464,7 +464,7 @@ const m = {
simulation.paused = true;
m.health = 0;
m.displayHealth();
document.getElementById("text-log").style.opacity = 0; //fade out any active text logs
document.getElementById("text-log").style.display = "none"
document.getElementById("fade-out").style.opacity = 0.9; //slowly fade to 90% white on top of canvas
// build.shareURL(false)
setTimeout(function() {
@@ -533,7 +533,7 @@ const m = {
},
baseHealth: 1,
setMaxHealth() {
m.maxHealth = m.baseHealth + tech.extraMaxHealth + 1.5 * tech.isFallingDamage + 4 * tech.isFlipFlop * tech.isFlipFlopOn * tech.isFlipFlopHealth //+ (m.fieldMode === 0 || m.fieldMode === 5) * 0.5 * m.coupling
m.maxHealth = m.baseHealth + tech.extraMaxHealth + 2 * tech.isFallingDamage + 4 * tech.isFlipFlop * tech.isFlipFlopOn * tech.isFlipFlopHealth //+ (m.fieldMode === 0 || m.fieldMode === 5) * 0.5 * m.coupling
document.getElementById("health-bg").style.width = `${Math.floor(300 * m.maxHealth)}px`
simulation.makeTextLog(`<span class='color-var'>m</span>.<span class='color-h'>maxHealth</span> <span class='color-symbol'>=</span> ${m.maxHealth.toFixed(2)}`)
if (m.health > m.maxHealth) m.health = m.maxHealth;
@@ -546,6 +546,8 @@ const m = {
let dmg = 1
dmg *= m.fieldHarmReduction
// if (!tech.isFlipFlopOn && tech.isFlipFlopHealth) dmg *= 0.5
// 1.25 + Math.sin(m.cycle * 0.01)
if (tech.isDiaphragm) dmg *= 0.66 + 0.66 * Math.sin(m.cycle * 0.01);
if (tech.isZeno) dmg *= 0.15
if (tech.isFieldHarmReduction) dmg *= 0.5
if (tech.isHarmMACHO) dmg *= 0.4
@@ -556,7 +558,7 @@ const m = {
if (m.fieldMode === 0 || m.fieldMode === 3) dmg *= 0.73 ** m.coupling
if (tech.isLowHealthDefense) dmg *= 1 - Math.max(0, 1 - m.health) * 0.8
if (tech.isHarmReduceNoKill && m.lastKillCycle + 300 < m.cycle) dmg *= 0.33
if (tech.squirrelFx !== 1) dmg *= 1 + (tech.squirrelFx - 1) / 5 //cause more damage
if (tech.squirrelFx !== 1) dmg *= 1 - 3 * (tech.squirrelFx - 1) / 5 //cause more damage
if (tech.isAddBlockMass && m.isHolding) dmg *= 0.15
if (tech.isSpeedHarm && player.speed > 0.1) dmg *= 1 - Math.min(player.speed * 0.0165, 0.66)
if (tech.isHarmReduce && input.field && m.fieldCDcycle < m.cycle) dmg *= 0.25
@@ -836,6 +838,9 @@ const m = {
draw() {},
isAltSkin: false,
resetSkin() {
m.yOffWhen.jump = 70
m.yOffWhen.stand = 49
m.yOffWhen.crouch = 22
m.isAltSkin = false
m.color = {
hue: 0,
@@ -912,6 +917,94 @@ const m = {
none() {
m.isAltSkin = true
},
mech() {
m.isAltSkin = true
m.yOffWhen.stand = 52
m.yOffWhen.jump = 72
// m.yOffWhen.crouch = 22
// m.color = {
// hue: 184,
// sat: 0,
// light: 55,
// }
// m.setFillColors();
m.draw = function() {
m.walk_cycle += m.flipLegs * m.Vx;
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5 //|| (m.cycle % 40 > 20)
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -1.25);
m.drawLeg("#606060");
m.calcLeg(0, 0);
m.drawLeg("#444");
ctx.rotate(m.angle);
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.arc(15, 0, 4, 0, 2 * Math.PI);
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
ctx.stroke();
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
}
m.drawLeg = function(stroke) {
if (m.angle > -Math.PI / 2 && m.angle < Math.PI / 2) {
m.flipLegs = 1;
} else {
m.flipLegs = -1;
}
const hip = { x: m.hip.x - 5, y: m.hip.y + 5 }
const sub = Vector.sub(m.knee, hip)
const off = Vector.mult(Vector.rotate(Vector.normalise(sub), Math.PI / 2), 8)
const kneeBraceHigh = Vector.add(hip, off)
const kneeBraceLow = Vector.add(kneeBraceHigh, Vector.mult(sub, 0.9))
const foot = { x: m.foot.x - 10, y: m.foot.y - 15 }
ctx.save();
ctx.scale(m.flipLegs, 1); //leg lines
ctx.beginPath();
ctx.moveTo(hip.x, hip.y);
ctx.lineTo(m.knee.x, m.knee.y);
ctx.lineTo(foot.x, foot.y);
//extra upper leg brace
ctx.moveTo(kneeBraceHigh.x, kneeBraceHigh.y);
ctx.lineTo(kneeBraceLow.x, kneeBraceLow.y);
ctx.lineTo(m.knee.x, m.knee.y);
ctx.strokeStyle = stroke;
ctx.lineWidth = 3;
ctx.stroke();
//foot
ctx.beginPath();
ctx.moveTo(foot.x, foot.y);
ctx.quadraticCurveTo(m.foot.x - 30, m.foot.y + 12, m.foot.x + 13, m.foot.y + 3);
ctx.lineWidth = 1.5;
ctx.stroke();
//hip joint
ctx.beginPath();
ctx.arc(m.hip.x, m.hip.y - 1, 11, 0, 2 * Math.PI);
//knee joint
ctx.moveTo(m.knee.x + 3, m.knee.y);
ctx.arc(m.knee.x, m.knee.y, 3, 0, 2 * Math.PI);
//knee brace
// ctx.moveTo(kneeBraceHigh.x + 4, kneeBraceHigh.y);
// ctx.arc(kneeBraceHigh.x, kneeBraceHigh.y, 4, 0, 2 * Math.PI);
ctx.moveTo(kneeBraceLow.x + 2.5, kneeBraceLow.y);
ctx.arc(kneeBraceLow.x, kneeBraceLow.y, 2.5, 0, 2 * Math.PI);
//foot joint
ctx.moveTo(foot.x + 2.5, foot.y);
ctx.arc(foot.x, foot.y, 2.5, 0, 2 * Math.PI);
ctx.fillStyle = m.fillColor;
ctx.fill();
ctx.lineWidth = 1;
// ctx.strokeStyle = "#333"
ctx.stroke();
ctx.restore();
}
},
energy() {
m.isAltSkin = true
m.color = {
@@ -1231,19 +1324,90 @@ const m = {
ctx.fill();
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
ctx.arc(12, 0, 8 + 4 * Math.sin(m.cycle * 0.01), 0, 2 * Math.PI); //big eye
ctx.stroke();
ctx.beginPath();
ctx.arc(12, 0, 8 + 4 * Math.sin(m.cycle * 0.01), 0, 2 * Math.PI); //big eye
ctx.fillStyle = `hsl(${150+100*Math.sin(m.cycle * 0.01)},100%,50%)`
ctx.fill();
ctx.strokeStyle = "#333";
ctx.lineWidth = 2;
ctx.stroke();
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
}
},
dilate2() {
m.isAltSkin = true
m.draw = function() {
ctx.fillStyle = m.fillColor;
m.walk_cycle += m.flipLegs * m.Vx;
ctx.save();
ctx.globalAlpha = (m.immuneCycle < m.cycle) ? 1 : 0.5 //|| (m.cycle % 40 > 20)
ctx.translate(m.pos.x, m.pos.y);
m.calcLeg(Math.PI, -3);
m.drawLeg("#5f5f5f");
m.calcLeg(0, 0);
m.drawLeg("#444");
ctx.rotate(m.angle);
ctx.beginPath();
ctx.arc(0, 0, 30, 0, 2 * Math.PI);
ctx.fillStyle = m.bodyGradient
ctx.fill();
ctx.strokeStyle = "#444";
ctx.lineWidth = 3 + 3 * Math.sin(m.cycle * 0.01 + Math.PI);
ctx.arc(12, 0, 6 + 3 * Math.sin(m.cycle * 0.01), 0, 2 * Math.PI); //big eye
ctx.stroke();
ctx.beginPath();
ctx.arc(12, 0, 6 + 3 * Math.sin(m.cycle * 0.01), 0, 2 * Math.PI); //big eye
ctx.fillStyle = `hsl(${150+100*Math.sin(m.cycle * 0.01)},100%,50%)`
ctx.fill();
ctx.stroke();
ctx.restore();
m.yOff = m.yOff * 0.85 + m.yOffGoal * 0.15; //smoothly move leg height towards height goal
powerUps.boost.draw()
}
m.drawLeg = function(stroke) {
// if (simulation.mouseInGame.x > m.pos.x) {
if (m.angle > -Math.PI / 2 && m.angle < Math.PI / 2) {
m.flipLegs = 1;
} else {
m.flipLegs = -1;
}
ctx.save();
ctx.scale(m.flipLegs, 1); //leg lines
ctx.beginPath();
ctx.moveTo(m.hip.x, m.hip.y);
ctx.lineTo(m.knee.x, m.knee.y);
ctx.lineTo(m.foot.x, m.foot.y);
ctx.strokeStyle = stroke;
ctx.lineWidth = 7;
ctx.stroke();
//toe lines
ctx.beginPath();
ctx.moveTo(m.foot.x, m.foot.y);
ctx.lineTo(m.foot.x - 15, m.foot.y + 5);
ctx.moveTo(m.foot.x, m.foot.y);
ctx.lineTo(m.foot.x + 15, m.foot.y + 5);
ctx.lineWidth = 4;
ctx.stroke();
//hip joint
ctx.beginPath();
ctx.arc(m.hip.x, m.hip.y, 11, 0, 2 * Math.PI);
//knee joint
ctx.moveTo(m.knee.x + 7, m.knee.y);
ctx.arc(m.knee.x, m.knee.y, 7, 0, 2 * Math.PI);
//foot joint
ctx.moveTo(m.foot.x + 6, m.foot.y);
ctx.arc(m.foot.x, m.foot.y, 6, 0, 2 * Math.PI);
ctx.fillStyle = m.fillColor;
ctx.fill();
ctx.lineWidth = 3 + 3 * Math.sin(m.cycle * 0.01 + Math.PI);
ctx.stroke();
ctx.restore();
}
},
CPT() {
m.isAltSkin = true
m.color = {